Advertisement
here2share

# frame_menu_demo.py

Nov 3rd, 2016
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.41 KB | None | 0 0
  1. # frame_menu_demo.py
  2.  
  3. import wx
  4. class Test( wx.Frame ):
  5.  
  6.     def __init__( self, parent ):
  7.         wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Frame Menu Demo", pos = wx.DefaultPosition, size = wx.Size( 300,200 ), style = wx.DEFAULT_FRAME_STYLE )
  8.  
  9.         self.panel = wx.Panel(self)
  10.         self.status = self.CreateStatusBar( 1, 0, wx.ID_ANY )
  11.  
  12.         self.menu = wx.MenuBar( 0 )
  13.         self.first = wx.Menu()
  14.         self.new = wx.MenuItem( self.first, wx.ID_ANY, "New", u"Start A New Project", wx.ITEM_NORMAL )
  15.         self.first.AppendItem( self.new )
  16.         self.open = wx.MenuItem( self.first, wx.ID_ANY, "Open...", u"Open A Saved Project", wx.ITEM_NORMAL )
  17.         self.first.AppendItem( self.open )
  18.         self.menu.Append( self.first, "File" )
  19.         self.second = wx.Menu()
  20.         self.aaa = wx.MenuItem( self.second, wx.ID_ANY, "AAA", u"aaa", wx.ITEM_NORMAL )
  21.         self.second.AppendItem( self.aaa )
  22.         self.bbb = wx.MenuItem( self.second, wx.ID_ANY, "BBB", u"bbb", wx.ITEM_NORMAL )
  23.         self.second.AppendItem( self.bbb )
  24.         self.ccc = wx.MenuItem( self.second, wx.ID_ANY, "CCC", u"ccc", wx.ITEM_NORMAL )
  25.         self.second.AppendItem( self.ccc )
  26.         self.menu.Append( self.second, "Menu" )
  27.         self.SetMenuBar( self.menu )
  28.         self.Centre( wx.BOTH )
  29.  
  30. if __name__=='__main__':
  31.     app=wx.App()
  32.     frame=Test(None)
  33.     frame.Show()
  34.     app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement