[wxPython-users] [wxGlade] Simple TAB_TRAVERSAL question
Marc Lebrun
marclebrun2 at gmail.com
Wed Dec 26 14:27:19 PST 2007
Robin Dunn wrote
> Put a wx.Panel in the frame, and put your controls on the panel.
>
Hi Robin,
Very glad to meet you :-)
I tried with a big panel on my frame but still can't make it work
properly, now the problem is when the focus is on the TextCtrl and I hit
Tab if goes to the grid without stopping on the button...
Here's how everything is set up :
My frame -> a vertical sizer -> the main panel -> another vertical sizer
-> TextCtrl + Panel with one button + Grid
The TAB_TRAVERSAL style is checked for the frame and for every panel.
I don't know if wxGlade has something to do with that problem.
BTW I'm using WinXP SP2, wxPython 2.8.7.1 msw-unicode, Python 2.5.1. and
wxGlade 0.6.1.
Here's the class that wxGlade produced :
class MyFrame2(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame2.__init__
kwds["style"] =
wx.CAPTION|wx.CLOSE_BOX|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|wx.SYSTEM_MENU|wx.RESIZE_BORDER|wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN
wx.Frame.__init__(self, *args, **kwds)
self.panel_2 = wx.Panel(self, -1)
self.panel_3 = wx.Panel(self.panel_2, -1)
self.text_ctrl_2 = wx.TextCtrl(self.panel_2, -1, "",
style=wx.TE_MULTILINE)
self.button_2 = wx.Button(self.panel_3, -1, "button_2")
self.grid_2 = wx.grid.Grid(self.panel_2, -1, size=(1, 1))
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: MyFrame2.__set_properties
self.SetTitle("frame_2")
self.grid_2.CreateGrid(10, 3)
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyFrame2.__do_layout
sizer_3 = wx.BoxSizer(wx.VERTICAL)
sizer_4 = wx.BoxSizer(wx.VERTICAL)
sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
sizer_4.Add(self.text_ctrl_2, 0, wx.EXPAND, 0)
sizer_5.Add(self.button_2, 0, 0, 0)
self.panel_3.SetSizer(sizer_5)
sizer_4.Add(self.panel_3, 0, wx.EXPAND, 0)
sizer_4.Add(self.grid_2, 1, wx.EXPAND, 0)
self.panel_2.SetSizer(sizer_4)
sizer_3.Add(self.panel_2, 1, wx.EXPAND, 0)
self.SetSizer(sizer_3)
sizer_3.Fit(self)
self.Layout()
# end wxGlade
# end of class MyFrame2
More information about the wxpython-users
mailing list