import wx import time import datetime import featuretest def now_time(): return time.asctime(time.localtime(time.time())) now = datetime.datetime.now() class MainWindow(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, title=title, size=(400, 200)) 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() optmenu = wx.Menu() # wx.ID_about and wx.ID_EXIT are standard IDs provided by wxWidgets. menuabout = filemenu.Append(wx.ID_ABOUT, "&about", " Information about this program") filemenu.AppendSeparator() menuExit = filemenu.Append(wx.ID_EXIT, "&Exit", " Terminate the program") meunopen = optmenu.Append(wx.ID_OPEN, "&open", "open a new app") meunopt = optmenu.Append(wx.ID_CLOSE,"&close","close the app-file") # Creating the menubar. menuBar = wx.MenuBar() menuBar.Append(filemenu, "&File") # Adding the "filemenu" to the MenuBar menuBar.Append(optmenu, "&option") self.Bind(wx.EVT_MENU, self.Onabout, menuabout) self.Bind(wx.EVT_MENU, self.OnExit, menuExit) self.Bind(wx.EVT_MENU,self.openfile,meunopen) self.Bind(wx.EVT_MENU, self.optfile, meunopt) self.SetMenuBar(menuBar) self.Show(True) def Onabout(self, e): dlg = wx.MessageDialog(self, "A small text editor", "about Sample Editor", wx.OK) dlg.ShowModal() # Show it dlg.Destroy() # finally destroy it when finished. def OnExit(self, e): self.Close(True) # Close the frame. def openfile(self,e): app = wx.App(False) frame = MainWindow(None, "Sample editor") app.MainLoop() def optfile(self,e): featuretest.digit_blackhole(10000) app = wx.App(False) frame = MainWindow(None, "Sample editor") app.MainLoop() for x in range(3): print("sssss\n",x)
简略版gui界面调用翻译模块featuretest
最新推荐文章于 2023-06-26 17:23:07 发布