|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Layout questions
Hi all,
I have a dialog with: 1. wx.gizmos.EditableListBox 2. wx.Panel that contains only a wx.Notebook 3. A close botton Here are my problems: 1. wxMac specific: only the title of the EditableListBox is visible. 2. I want the dialog's width to fit all controls, including the size of the notebook tabs. Currently it only fits the listbox size and notebook *page*size. So not all tabs are visible (MSW: There's an arrow that allows viewing more tabs. Mac: some of the tabs are simply not visible). Sample code attached. Thanks, Roee. """ 1. wxMac: the title of the wx.gizmos.EditableListBox instance is visible. So it isn't possible to add new items. 2. All: How can I fit the dialog size to the notebook's tabs? """ import wx import wx.gizmos _ = wx.GetTranslation class TemplatesDialog(wx.Dialog): """ The Dialog """ def __init__(self, parent): wx.Dialoginit__(self, parent, -1, _("Templates Dialog")) # wx.gizmos.EditableListBox self.list = TemplatesList(self) # wx.Panel with wx.Notebook self.options = T(self) # Close Button closebtn = wx.Button(self, wx.ID_CLSE, _('Close')) # Layout sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.list, 1, wx.EXPAND|wx.ALL, 5) sizer.Add(self.options, 0, wx.EXPAND|wx.ALL, 5) sizer.Add(closebtn, 0, wx.ALIGN_LEFT | wx.ALL, 5) self.SetAutoLayout(True) self.SetSizerAndFit(sizer) # Events self.Bind(wx.EVT_BUTTN, self.onClose, id = wx.ID_CLSE) def onClose(self, event): self.EndModal(wx.IDK) class TemplatesList(wx.gizmos.EditableListBox): """ Editable listbox """ def __init__(self, parent): (self, parent, -1, _("Templates")) def GetSelection(self): return self.GetListCtrl().GetItemText(self.GetListCtrl ().GetFirstSelected()) class T(wx.Panel): """ Panel with a notebook """ def __init__(self, parent): wx.Panelinit__(self, parent) self.parent = parent sizer = wx.BoxSizer(wx.VERTICAL) self.book = wx.Notebook(self, -1) self.Initialise() sizer.Add(self.book, 0, wx.EXPAND, 1) self.SetSizer(sizer) def Initialise(self): """ Initialzes the options pages. """ self.book.DeleteAllPages() self.p1 = BasePanel(self, _("First Page")) self.p2 = BasePanel(self, _("Second Page")) self.p3 = BasePanel(self, _("Third Page")) self.p4 = BasePanel(self, _("Fourth Page")) self.book.AddPage(self.p1, self.p1.title, True) self.book.AddPage(self.p2, self.p2.title, False) self.book.AddPage(self.p3, self.p3.title, False) self.book.AddPage(self.p4, self.p4.title, False) class BasePanel(wx.Panel): """ A notebook page """ def __init__(self, parent, title): wx.Panelinit__(self, parent.book, -1) self.parent = parent self.title = title self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add((-1,10)) for i in range(10): self.sizer.Add(wx.StaticText(self, -1, " Line Number : %d " % i), 0) self.SetSizer(self.sizer) app = wx.App() dlg = TemplatesDialog(None) dlg.ShowModal() dlg.Destroy() |
![]() |
| Viewing: Web Development Archives > Mailing Lists > Python > Layout questions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|