]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxFrame.py
Switch to a read-only combobox
[wxWidgets.git] / wxPython / demo / wxFrame.py
1 # 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 #
5
6 import wx
7
8 #---------------------------------------------------------------------------
9
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 ):
15
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)
23
24
25 def OnCloseMe(self, event):
26 self.Close(True)
27
28 def OnCloseWindow(self, event):
29 self.Destroy()
30
31 #---------------------------------------------------------------------------
32
33 def runTest(frame, nb, log):
34 win = MyFrame(frame, -1, "This is a wxFrame", size=(350, 200),
35 style = wx.DEFAULT_FRAME_STYLE)# | wx.FRAME_TOOL_WINDOW )
36 frame.otherWin = win
37 win.Show(True)
38
39
40 #---------------------------------------------------------------------------
41
42
43 overview = """\
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.
64 """
65
66
67 if __name__ == '__main__':
68 import sys,os
69 import run
70 run.main(['', os.path.basename(sys.argv[0])])
71