]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/wxFrame.py
Added XML simplification scripts for generating the wxPython metadata xml.
[wxWidgets.git] / wxPython / demo / wxFrame.py
... / ...
CommitLineData
1# 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2#
3# o Updated for wx namespace
4#
5
6import wx
7
8#---------------------------------------------------------------------------
9
10class 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
33def 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
43overview = """\
44A Frame is a window whose size and position can (usually) be changed by
45the user. It usually has thick borders and a title bar, and can optionally
46contain a menu bar, toolbar and status bar. A frame can contain any window
47that is not a Frame or Dialog. It is one of the most fundamental of the
48wxWindows components.
49
50A Frame that has a status bar and toolbar created via the
51<code>CreateStatusBar</code> / <code>CreateToolBar</code> functions manages
52these windows, and adjusts the value returned by <code>GetClientSize</code>
53to reflect the remaining size available to application windows.
54
55By itself, a Frame is not too useful, but with the addition of Panels and
56other child objects, it encompasses the framework around which most user
57interfaces are constructed.
58
59If you plan on using Sizers and auto-layout features, be aware that the Frame
60class lacks the ability to handle these features unless it contains a Panel.
61The Panel has all the necessary functionality to both control the size of
62child components, and also communicate that information in a useful way to
63the Frame itself.
64"""
65
66
67if __name__ == '__main__':
68 import sys,os
69 import run
70 run.main(['', os.path.basename(sys.argv[0])])
71