[wxPython-users] Re: Default Sizers, First Draft (was Re: [wxPython-users] Parent of wx.BoxSizer?)

Dj Gilcrease digitalxero at gmail.com
Thu Jun 1 17:50:41 PDT 2006


On 6/1/06, Tim Roberts <timr at probo.com> wrote:
> I'm afraid multiple independent "tab groups" would be terribly
> confusing.  How would I switch from one group into another?  Pressing
> the tab button like my son presses the A button on his Gameboy should
> allow me to visit every control.
>

Maybe like this:

Tab Group 1:
   item1
      TabNext = item1
   item2
      TabPrev = item1
      TabNext = item3
   item3
      TabPrev = item2

Tab Group 2:
   item1.2
      TabNext = item2.2
   item2.2
      TabPrev = item1.2
      TabNext = item 3.2
   item3.2
      TabPrev = item2.2

If an item does not have a previous or next tab order property set it
would jump to the next group if one existed or to the proper item in
the group.

Thinking to myself:

wx.TabGroup(self, *args, **kwargs):
    whatever init code here

    def AddItem(self, item):
        whatever code here

    def InsertItem(self, item, position):
         whatever code here to insert the item in the position and
shift all items after that position down one


now to use this wx.Window would need a tabgroup property so you can
use self.SetTabGroup similar to how self.SetSizer is

Sudo code

class SomeFrame(wx.Frame):
    panel = wx.Panel(self, blabla)
    button1 = wx.Button(panel, bla)
    button2 = wx.Button(panel, bla)

    panel2 = wx.Panel(self, blabla)
    button3 = wx.Button(panel2, bla)
    button4 = wx.Button(panel2, bla)

    tabgroup1 = wx.TabGroup(blabla)
    tabgroup1.AddItem(button1)
    tabgroup1.Additem(button2)
    panel.SetTabGroup(tabgroup1)

    tabgroup2 = wx.TabGroup(blabla)
    tabgroup2.AddItem(button3)
    tabgroup2.AddItem(button4)
    panel.SetTabGroup(tabgroup2)

    self.tabgroup = wx.TabGroup(blabla)
    self.tabgroup.AddItem(tabgroup2)
    self.tabgroup.AddItem(tabgroup1)
    self.SetTabGroup(self.tabgroup)

end Sudo Code:

Now this would create a frabe with two panels with buttons. The tab
order would be panel2.button3, panel2.button4, panel1.button1,
panel1.button2

The reason panel2 goes first is because it is the first item in the
frames tab order




More information about the wxpython-users mailing list