de este
Código python:
Ver original
import wx class MDIFrame(wx.MDIParentFrame): def __init__(self, parent, id, title): wx.MDIParentFrame.__init__(self, parent, id, title, size=(600,400)) menu = wx.Menu() menu.Append(5000, "&New Window\tCtrl+N", 'New window') menu.Append(100, "&Save\tCtrl+S", 'Seve file') menu.Append(5001, '&Quit\tCtrl+Q', 'Close the program') menubar = wx.MenuBar() menubar.Append(menu, "&File") self.SetMenuBar(menubar) self.Bind(wx.EVT_MENU, self.OnNewWindow, id=5000) self.Bind(wx.EVT_MENU, self.OnExit, id=5001) self.CreateToolBar(wx.EXPAND) self.CreateStatusBar() self.Show(True) def OnExit(self, evt): self.Close(True) def OnNewWindow(self, evt): win = wx.MDIChildFrame(self, -1, "Child Window") wx.TextCtrl(win, -1, style= wx.TE_MULTILINE) win.Show(True) app = wx.PySimpleApp() MDIFrame(None, -1, 'non') app.MainLoop()
a este
Código python:
Ver original
import wx class Toolbars(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(700, 650)) menubar = wx.MenuBar() file = wx.Menu() new = wx.MenuItem(file, 2, '&New\tCtrl+N', 'new file') file.AppendItem(new) file.AppendSeparator() quit = wx.MenuItem(file, 1, '&Quit\tCtrl+Q', 'Exit program') file.AppendItem(quit) edit = wx.Menu() copy = wx.MenuItem(edit, 3, '&Copy\tCtrl+C', 'Copy selected') edit.AppendItem(copy) cut = wx.MenuItem(edit, 4, '&Cut\tCtrl+X', 'Cut selected') edit.AppendItem(cut) menubar.Append(file, '&File') menubar.Append(edit, '&Edit') self.SetMenuBar(menubar) self.Bind(wx.EVT_MENU, self.OnQuit, id=1) vbox = wx.BoxSizer(wx.VERTICAL) toolbar1 = wx.ToolBar(self, 1) toolbar1.AddLabelTool(wx.ID_EXIT, '', wx.Bitmap('../Lamp/exit.png')) toolbar1.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('../lamp/exit.png')) toolbar1.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('../lamp/exit.png')) toolbar1.Realize() toolbar2 = wx.ToolBar(self, 1) toolbar2.AddLabelTool(wx.ID_ANY, '', wx.Bitmap('../lamp/exit.png')) wx.ComboBox(toolbar2, pos=(100, 0)) toolbar2.Realize() vbox.Add(toolbar1, 0, wx.EXPAND) vbox.Add(toolbar2, 0, wx.EXPAND) self.Bind(wx.EVT_TOOL, self.OnExit, id=wx.ID_EXIT) self.SetSizer(vbox) self.statusbar = self.CreateStatusBar() self.Centre() self.Show(True) def OnExit(self, event): self.Close() def OnQuit(self, event): self.Close() app = wx.App() Toolbars(None, -1, 'Universal Grapics') app.MainLoop()