]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/Frame.py
4 #---------------------------------------------------------------------------
6 class MyFrame(wx
.Frame
):
8 self
, parent
, ID
, title
, pos
=wx
.DefaultPosition
,
9 size
=wx
.DefaultSize
, style
=wx
.DEFAULT_FRAME_STYLE
12 wx
.Frame
.__init
__(self
, parent
, ID
, title
, pos
, size
, style
)
13 panel
= wx
.Panel(self
, -1)
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
)
21 def OnCloseMe(self
, event
):
24 def OnCloseWindow(self
, event
):
27 #---------------------------------------------------------------------------
29 def runTest(frame
, nb
, log
):
30 win
= MyFrame(frame
, -1, "This is a wx.Frame", size
=(350, 200),
31 style
= wx
.DEFAULT_FRAME_STYLE
)# | wx.FRAME_TOOL_WINDOW )
36 #---------------------------------------------------------------------------
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
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.
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.
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
63 if __name__
== '__main__':
66 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])