wxPython メニューバーを作る
windowのメニューバーで、ファイル(File)、編集(Edit)を作ってみる。
ついでにステータスバーも作る。
見慣れたwindow画面らしくなる。
#!/usr/bin/env python
#coding:utf-8
import wx
class MyWindow(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,"MyTitle",size=(300,200))
panel=wx.Panel(self)
status=self.CreateStatusBar()
menubar=wx.MenuBar()
first=wx.Menu()
second=wx.Menu()
first.Append(wx.NewId(),"New Window","This is a new window")
first.Append(wx.NewId(),"Open...","This will open a new window")
menubar.Append(first,"File")
menubar.Append(second,"Edit")
self.SetMenuBar(menubar)
if __name__=='__main__':
app=wx.PySimpleApp()
frame=MyWindow(parent=None,id=-1)
frame.Show()
app.MainLoop()

