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