]>
Commit | Line | Data |
---|---|---|
cf694132 | 1 | |
8fa876ca | 2 | import wx |
cf694132 RD |
3 | |
4 | #--------------------------------------------------------------------------- | |
5 | ||
8fa876ca RD |
6 | class MyFrame(wx.Frame): |
7 | def __init__( | |
8 | self, parent, ID, title, pos=wx.DefaultPosition, | |
9 | size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE | |
10 | ): | |
cf694132 | 11 | |
8fa876ca RD |
12 | wx.Frame.__init__(self, parent, ID, title, pos, size, style) |
13 | panel = wx.Panel(self, -1) | |
14 | ||
15 | button = wx.Button(panel, 1003, "Close Me") | |
16 | button.SetPosition((15, 15)) | |
17 | self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button) | |
18 | self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) | |
f6bcfd97 | 19 | |
cf694132 RD |
20 | |
21 | def OnCloseMe(self, event): | |
1e4a197e | 22 | self.Close(True) |
cf694132 RD |
23 | |
24 | def OnCloseWindow(self, event): | |
25 | self.Destroy() | |
26 | ||
27 | #--------------------------------------------------------------------------- | |
28 | ||
29 | def runTest(frame, nb, log): | |
95bfd958 | 30 | win = MyFrame(frame, -1, "This is a wx.Frame", size=(350, 200), |
8fa876ca | 31 | style = wx.DEFAULT_FRAME_STYLE)# | wx.FRAME_TOOL_WINDOW ) |
cf694132 | 32 | frame.otherWin = win |
1e4a197e | 33 | win.Show(True) |
cf694132 RD |
34 | |
35 | ||
36 | #--------------------------------------------------------------------------- | |
37 | ||
38 | ||
cf694132 | 39 | overview = """\ |
8fa876ca RD |
40 | A Frame is a window whose size and position can (usually) be changed by |
41 | the user. It usually has thick borders and a title bar, and can optionally | |
42 | contain a menu bar, toolbar and status bar. A frame can contain any window | |
43 | that is not a Frame or Dialog. It is one of the most fundamental of the | |
44 | wxWindows components. | |
45 | ||
46 | A Frame that has a status bar and toolbar created via the | |
47 | <code>CreateStatusBar</code> / <code>CreateToolBar</code> functions manages | |
48 | these windows, and adjusts the value returned by <code>GetClientSize</code> | |
49 | to reflect the remaining size available to application windows. | |
50 | ||
51 | By itself, a Frame is not too useful, but with the addition of Panels and | |
52 | other child objects, it encompasses the framework around which most user | |
53 | interfaces are constructed. | |
54 | ||
55 | If you plan on using Sizers and auto-layout features, be aware that the Frame | |
56 | class lacks the ability to handle these features unless it contains a Panel. | |
57 | The Panel has all the necessary functionality to both control the size of | |
58 | child components, and also communicate that information in a useful way to | |
59 | the Frame itself. | |
cf694132 | 60 | """ |
1fded56b RD |
61 | |
62 | ||
1fded56b RD |
63 | if __name__ == '__main__': |
64 | import sys,os | |
65 | import run | |
66 | run.main(['', os.path.basename(sys.argv[0])]) | |
67 |