]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/MiniFrame.py
use Bind
[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
28def runTest(frame, nb, log):
95bfd958 29 win = MyMiniFrame(frame, "This is a wx.MiniFrame",
a9fd2e6f 30 #pos=(250,250), size=(200,200),
8fa876ca 31 style=wx.DEFAULT_FRAME_STYLE | wx.TINY_CAPTION_HORIZ)
6bff4be5 32 win.SetSize((200, 200))
8fa876ca 33 win.CenterOnParent(wx.BOTH)
cf694132 34 frame.otherWin = win
1e4a197e 35 win.Show(True)
cf694132
RD
36
37
38#---------------------------------------------------------------------------
39
40
cf694132 41overview = """\
95bfd958 42A MiniFrame is a Frame with a small title bar. It is suitable for floating
8fa876ca 43toolbars that must not take up too much screen area. In other respects, it's the
95bfd958 44same as a wx.Frame.
cf694132 45"""
1fded56b
RD
46
47
1fded56b
RD
48if __name__ == '__main__':
49 import sys,os
50 import run
51 run.main(['', os.path.basename(sys.argv[0])])