首页 > 代码库 > 简单的文本编辑器
简单的文本编辑器
#!/usr/bin/env pythonimport wxclass MainWindow(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, title=title, size=(200,100)) self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE) self.CreateStatusBar() # A Statusbar in the bottom of the window # Setting up the menu. filemenu= wx.Menu() # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets. aboutItem=filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program") self.Bind(wx.EVT_MENU, self.About, aboutItem) filemenu.AppendSeparator() exitItem=filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program") self.Bind(wx.EVT_MENU,self.Exit,exitItem) # Creating the menubar. menuBar = wx.MenuBar() menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. self.Show(True) def About(self,Event): dlg=wx.MessageDialog(self,"A small text editor","about sample editor",wx.OK) dlg.ShowModal() dlg.Destroy() if __name__==‘__main__‘: app = wx.App(False) frame = MainWindow(None, "Sample editor") app.MainLoop()
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。