]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/Frame.py
xcode 1.2 native targets
[wxWidgets.git] / wxPython / demo / Frame.py
1
2 import wx
3
4 #---------------------------------------------------------------------------
5
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 ):
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
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 )
32 frame.otherWin = win
33 win.Show(True)
34
35
36 #---------------------------------------------------------------------------
37
38
39 overview = """\
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.
60 """
61
62
63 if __name__ == '__main__':
64 import sys,os
65 import run
66 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
67