def __init__(self, title='ImagePy TexLog'):
wx.Frame.__init__(self, IPy.curapp,title=title,size=(500,300))
logopath = os.path.join(root_dir, 'data/logo.ico')
self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO))
self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) )
self.title = title
TextLogManager.add(title, self)
self.file=''
### Create menus (name:event) k-v pairs
menus = [
## File
('File(&F)',[('Open', self.OnOpen),
('Save', self.OnSave),
('Save as', self.OnSaveAs),
('-'),
('Exit', self.OnClose)
]),
## Edit
('Edit(&E)', [ ('Undo', self.OnUndo),
('Redo', self.OnRedo),
('-'),
('Cut', self.OnCut),
('Copy', self.OnCopy),
('Paste', self.OnPaste),
('-'),
('All', self.OnSelectAll)
]),
## Help
('Help(&H)', [('About', self.OnAbout)])
]
### Bind menus with the corresponding events
self.menuBar=wx.MenuBar()
for menu in menus:
m = wx.Menu()
for item in menu[1]:
if item[0]=='-':
m.AppendSeparator()
else:
i = m.Append(-1, item[0])
self.Bind(wx.EVT_MENU,item[1], i)
self.menuBar.Append(m,menu[0])
self.SetMenuBar(self.menuBar)
self.Bind(wx.EVT_CLOSE, self.OnClosing)
sizer = wx.BoxSizer( wx.VERTICAL )
self.text= wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString,
wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
sizer.Add( self.text, 1, wx.ALL|wx.EXPAND, 1 )
self.SetSizer( sizer )
self.Bind(wx.EVT_RIGHT_DOWN,self.OnRClick)
评论列表
文章目录