def __init_ctrls(self, disabled): self.totalLbl = wx.StaticText(self, -1, label='Due Amount') self.totalTxt = wx.TextCtrl(self, -1, style=wx.TE_READONLY) self.separationLine = wx.StaticLine(self, -1) self.mainToolbook = wx.Toolbook(self, -1, style=wx.BK_LEFT) # TODO PayDialog is not using a wx.ImageList self.mainToolbook.AssignImageList(wx.ImageList(16, 16)) toolbar = self.mainToolbook.GetToolBar() selected = None panels = (CashPanel, ChequePanel, CardPanel, VoucherPanel, FreePanel, DebtPanel) for p, panel_class in enumerate(panels): panel = panel_class(self.mainToolbook, self) self.mainToolbook.AddPage(imageId=-1, page=panel, select=False, text=panel.label) if not panel.IsAllowed() or panel.payment[0] in disabled: toolbar.EnableTool(p + 1, False) elif selected is None: selected = p self.mainToolbook.ChangeSelection(p) self.okBtn = wx.Button(self, wx.ID_OK, label='OK') self.okBtn.Bind(wx.EVT_BUTTON, self.OnOkButton) self.printBtn = wx.Button(self, -1, label='Print') self.printBtn.Bind(wx.EVT_BUTTON, self.OnPrintButton) self.cancelBtn = wx.Button(self, wx.ID_CANCEL, label='Cancel')
def __init__(self, parent): wx.Frame.__init__(self, parent, -1, size=wx.Size(800, 600), title='App Frame') # Main toolbook that will contain all the modules' pages self.mainToolbook = wx.Toolbook(self, -1) self.actionToolbar = wx.ToolBar(self, -1, style=wx.TB_VERTICAL | wx.TB_BOTTOM) bmp = wx.ArtProvider.GetBitmap(wx.ART_QUIT, size=(16, 16)) quit_tool = self.actionToolbar.AddLabelTool(-1, 'Quit', bmp) self.Bind(wx.EVT_MENU, self.OnQuit, quit_tool) self.actionToolbar.Realize() # Simple sizer to stretch the content to fit the frame self.mainSizer = wx.BoxSizer(orient=wx.HORIZONTAL) self.mainSizer.Add(self.mainToolbook, 1, border=0, flag=wx.EXPAND | wx.ALL) self.mainSizer.Add(self.actionToolbar, 0, border=0, flag=wx.EXPAND | wx.ALL) self.SetSizer(self.mainSizer) # Binding to fix a bug when closing the main frame self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(wx.EVT_IDLE, self.OnIdle) self.Bind(wx.EVT_SHOW, self.OnShow)
def getToolbookPage(self, items): """ Returns the appropriate window to be placed in the main Toolbook depending on the items of a root menu item. """ count = len(items) if count == 0: page = wx.Panel(self.mainToolbook, -1) page.Enable(False) return page elif count == 1: page = items[0].page(self.mainToolbook) page.Enable(items[0].enabled) return page else: toolbook = wx.Toolbook(self.mainToolbook, -1) toolbook.AssignImageList(pos.menu.il) for item in items: page = item.page(toolbook) toolbook.AddPage(imageId=item.image, page=page, select=False, text=item.label) page.Enable(item.enabled) return toolbook
def test_toolbook3(self): book = wx.Toolbook(self.frame) il = wx.ImageList(32, 32) for name in toolImgFiles: il.Add(wx.Bitmap(name)) book.AssignImageList(il) book.AddPage(wx.Panel(book), 'one', imageId=0) book.AddPage(wx.Panel(book), 'two', imageId=1) book.AddPage(wx.Panel(book), 'three', imageId=2) book.AddPage(wx.Panel(book), 'four', imageId=3) self.myYield()
def __init__(self, parent, IDfamille=None): wx.Panel.__init__(self, parent, id=-1, name="DLG_Tableau_bord_locations", style=wx.TAB_TRAVERSAL) self.parent = parent self.IDfamille = IDfamille self.ctrl_labelbook = wx.Toolbook(self, -1, style=wx.BK_TOP) # LB.FlatImageBook(self, -1, agwStyle=LB.INB_TOP) self.InitLabelbook() # --- Layout --- sizer_base = wx.BoxSizer(wx.VERTICAL) sizer_base.Add(self.ctrl_labelbook, 1, wx.EXPAND | wx.ALL, 0) self.SetSizer(sizer_base) sizer_base.Fit(self) self.Layout()
def test_toolbook2(self): book = wx.Toolbook() book.Create(self.frame)