]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/Frame.py
Added export decl
[wxWidgets.git] / wxPython / demo / Frame.py
CommitLineData
cf694132 1
8fa876ca 2import wx
cf694132
RD
3
4#---------------------------------------------------------------------------
5
8fa876ca
RD
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 ):
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
29def 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 39overview = """\
8fa876ca
RD
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.
cf694132 60"""
1fded56b
RD
61
62
1fded56b
RD
63if __name__ == '__main__':
64 import sys,os
65 import run
66 run.main(['', os.path.basename(sys.argv[0])])
67