]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MiniFrame.py
Set the DC font before drawing the label
[wxWidgets.git] / wxPython / demo / MiniFrame.py
1 # 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 #
5
6 import wx
7
8 #---------------------------------------------------------------------------
9 class MyMiniFrame(wx.MiniFrame):
10 def __init__(
11 self, parent, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
12 style=wx.DEFAULT_FRAME_STYLE
13 ):
14
15 wx.MiniFrame.__init__(self, parent, -1, title, pos, size, style)
16 panel = wx.Panel(self, -1)
17
18 button = wx.Button(panel, -1, "Close Me")
19 button.SetPosition((15, 15))
20 self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button)
21 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
22
23 def OnCloseMe(self, event):
24 self.Close(True)
25
26 def OnCloseWindow(self, event):
27 print "OnCloseWindow"
28 self.Destroy()
29
30 #---------------------------------------------------------------------------
31
32 def runTest(frame, nb, log):
33 win = MyMiniFrame(frame, "This is a wxMiniFrame",
34 #pos=(250,250), size=(200,200),
35 style=wx.DEFAULT_FRAME_STYLE | wx.TINY_CAPTION_HORIZ)
36 win.SetSize((200, 200))
37 win.CenterOnParent(wx.BOTH)
38 frame.otherWin = win
39 win.Show(True)
40
41
42 #---------------------------------------------------------------------------
43
44
45 overview = """\
46 A miniframe is a frame with a small title bar. It is suitable for floating
47 toolbars that must not take up too much screen area. In other respects, it's the
48 same as a wxFrame.
49 """
50
51
52 if __name__ == '__main__':
53 import sys,os
54 import run
55 run.main(['', os.path.basename(sys.argv[0])])