]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/MiniFrame.py
non-PCH build fix (according to Tinderbox).
[wxWidgets.git] / wxPython / demo / MiniFrame.py
CommitLineData
cf694132 1
8fa876ca 2import wx
cf694132
RD
3
4#---------------------------------------------------------------------------
8fa876ca
RD
5class MyMiniFrame(wx.MiniFrame):
6 def __init__(
7 self, parent, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
8 style=wx.DEFAULT_FRAME_STYLE
9 ):
cf694132 10
8fa876ca
RD
11 wx.MiniFrame.__init__(self, parent, -1, title, pos, size, style)
12 panel = wx.Panel(self, -1)
13
14 button = wx.Button(panel, -1, "Close Me")
15 button.SetPosition((15, 15))
16 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button)
17 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
cf694132
RD
18
19 def OnCloseMe(self, event):
1e4a197e 20 self.Close(True)
cf694132
RD
21
22 def OnCloseWindow(self, event):
1e4a197e 23 print "OnCloseWindow"
cf694132
RD
24 self.Destroy()
25
26#---------------------------------------------------------------------------
27
34a544a6
RD
28class TestPanel(wx.Panel):
29 def __init__(self, parent, log):
30 self.log = log
31 wx.Panel.__init__(self, parent, -1)
32
33 b = wx.Button(self, -1, "Create and Show a MiniFrame", (50,50))
34 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
35
36
37 def OnButton(self, evt):
38 win = MyMiniFrame(self, "This is a wx.MiniFrame",
39 style=wx.DEFAULT_FRAME_STYLE | wx.TINY_CAPTION_HORIZ)
40 win.SetSize((200, 200))
41 win.CenterOnParent(wx.BOTH)
42 win.Show(True)
43
44
45#---------------------------------------------------------------------------
46
47
cf694132 48def runTest(frame, nb, log):
34a544a6
RD
49 win = TestPanel(nb, log)
50 return win
cf694132
RD
51
52
53#---------------------------------------------------------------------------
54
55
cf694132 56overview = """\
95bfd958 57A MiniFrame is a Frame with a small title bar. It is suitable for floating
8fa876ca 58toolbars that must not take up too much screen area. In other respects, it's the
95bfd958 59same as a wx.Frame.
cf694132 60"""
1fded56b
RD
61
62
1fded56b
RD
63if __name__ == '__main__':
64 import sys,os
65 import run
8eca4fef 66 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])