]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MiniFrame.py
4 #---------------------------------------------------------------------------
5 class MyMiniFrame(wx
.MiniFrame
):
7 self
, parent
, title
, pos
=wx
.DefaultPosition
, size
=wx
.DefaultSize
,
8 style
=wx
.DEFAULT_FRAME_STYLE
11 wx
.MiniFrame
.__init
__(self
, parent
, -1, title
, pos
, size
, style
)
12 panel
= wx
.Panel(self
, -1)
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
)
19 def OnCloseMe(self
, event
):
22 def OnCloseWindow(self
, event
):
26 #---------------------------------------------------------------------------
28 class TestPanel(wx
.Panel
):
29 def __init__(self
, parent
, log
):
31 wx
.Panel
.__init
__(self
, parent
, -1)
33 b
= wx
.Button(self
, -1, "Create and Show a MiniFrame", (50,50))
34 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
)
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
)
45 #---------------------------------------------------------------------------
48 def runTest(frame
, nb
, log
):
49 win
= TestPanel(nb
, log
)
53 #---------------------------------------------------------------------------
57 A MiniFrame is a Frame with a small title bar. It is suitable for floating
58 toolbars that must not take up too much screen area. In other respects, it's the
63 if __name__
== '__main__':
66 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])