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