]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/Frame.py
Don't use deprecated wx.MaskColour
[wxWidgets.git] / wxPython / demo / Frame.py
... / ...
CommitLineData
1
2import wx
3
4#---------------------------------------------------------------------------
5
6class MyFrame(wx.Frame):
7 def __init__(
8 self, parent, ID, title, pos=wx.DefaultPosition,
9 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE
10 ):
11
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)
19
20
21 def OnCloseMe(self, event):
22 self.Close(True)
23
24 def OnCloseWindow(self, event):
25 self.Destroy()
26
27#---------------------------------------------------------------------------
28
29def 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 )
32 frame.otherWin = win
33 win.Show(True)
34
35
36#---------------------------------------------------------------------------
37
38
39overview = """\
40A Frame is a window whose size and position can (usually) be changed by
41the user. It usually has thick borders and a title bar, and can optionally
42contain a menu bar, toolbar and status bar. A frame can contain any window
43that is not a Frame or Dialog. It is one of the most fundamental of the
44wxWindows components.
45
46A Frame that has a status bar and toolbar created via the
47<code>CreateStatusBar</code> / <code>CreateToolBar</code> functions manages
48these windows, and adjusts the value returned by <code>GetClientSize</code>
49to reflect the remaining size available to application windows.
50
51By itself, a Frame is not too useful, but with the addition of Panels and
52other child objects, it encompasses the framework around which most user
53interfaces are constructed.
54
55If you plan on using Sizers and auto-layout features, be aware that the Frame
56class lacks the ability to handle these features unless it contains a Panel.
57The Panel has all the necessary functionality to both control the size of
58child components, and also communicate that information in a useful way to
59the Frame itself.
60"""
61
62
63if __name__ == '__main__':
64 import sys,os
65 import run
66 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
67