]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-10/fancy_items.py
don't use strlen() to verify the length of the string as it can contain embedded...
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-10 / fancy_items.py
1 import wx
2
3 class MyFrame(wx.Frame):
4 def __init__(self):
5 wx.Frame.__init__(self, None, -1,
6 "Fancier Menu Example")
7 p = wx.Panel(self)
8 menu = wx.Menu()
9
10 bmp = wx.Bitmap("open.png", wx.BITMAP_TYPE_PNG)
11 item = wx.MenuItem(menu, -1, "Has Open Bitmap")
12 item.SetBitmap(bmp)
13 menu.AppendItem(item)
14
15 if True or 'wxMSW' in wx.PlatformInfo:
16 font = wx.SystemSettings.GetFont(
17 wx.SYS_DEFAULT_GUI_FONT)
18 font.SetWeight(wx.BOLD)
19 item = wx.MenuItem(menu, -1, "Has Bold Font")
20 item.SetFont(font)
21 menu.AppendItem(item)
22
23 item = wx.MenuItem(menu, -1, "Has Red Text")
24 item.SetTextColour("red")
25 menu.AppendItem(item)
26
27
28 menu.AppendSeparator()
29 exit = menu.Append(-1, "Exit")
30 self.Bind(wx.EVT_MENU, self.OnExit, exit)
31
32 menuBar = wx.MenuBar()
33 menuBar.Append(menu, "Menu")
34 self.SetMenuBar(menuBar)
35
36
37 def OnExit(self, event):
38 self.Close()
39
40
41 if __name__ == "__main__":
42 app = wx.PySimpleApp()
43 frame = MyFrame()
44 frame.Show()
45 app.MainLoop()
46
47