[wxGlade] Simple TAB_TRAVERSAL question
Marc Lebrun
marclebrun at skynet.be
Wed Dec 26 11:46:32 PST 2007
Hello :-)
Please consider the following .WXG file and the .PY file it produces.
It's a simple frame with one vertical sizer which has three slots.
In the three slots I have a multiline wxTextCtrl, a wxPanel, and a wxGrid.
In the wxPanel I have another sizer with only one button in it.
I set the wxTAB_TRAVERSAL for the frame and the panel.
But the TAB behaviour is not working at all.
What I'd like to do is type some text on the wxTextCtrl, then hit Tab to go
to the button, hit Space to click hit, and then hit Tab to go to the grid.
I can't seem to find a way to do it... I know I'm missing something but
don't know what...
Thanks for helping :-)
Marc.
.WXG file :
<?xml version=3D"1.0"?>
<!-- generated by wxGlade 0.6.1 on Wed Dec 26 08:59:12 2007 -->
<application path=3D"C:\prgpy\wxglade-test\tabtest\tabtest.py" name=3D""
class=3D"" option=3D"0" language=3D"python" top_window=3D"frame_1"
encoding=3D"ISO-8859-15" use_gettext=3D"0" overwrite=3D"0" use_new_namespac=
e=3D"1"
for_version=3D" 2.8" is_template=3D"0">
<object class=3D"MyFrame" name=3D"frame_1" base=3D"EditFrame">
<style>wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxSYSTEM_MENU|wx=
RESIZE_BORDER|wxTAB_TRAVERSAL|wxCLIP_CHILDREN</style>
<title>frame_1</title>
<object class=3D"wxBoxSizer" name=3D"sizer_1" base=3D"EditBoxSizer">
<orient>wxVERTICAL</orient>
<object class=3D"sizeritem">
<flag>wxEXPAND</flag>
<border>0</border>
<option>0</option>
<object class=3D"wxTextCtrl" name=3D"text_ctrl_1"
base=3D"EditTextCtrl">
<style>wxTE_MULTILINE</style>
</object>
</object>
<object class=3D"sizeritem">
<flag>wxEXPAND</flag>
<border>0</border>
<option>0</option>
<object class=3D"wxPanel" name=3D"panel_1" base=3D"EditPane=
l">
<style>wxTAB_TRAVERSAL</style>
<object class=3D"wxBoxSizer" name=3D"sizer_2"
base=3D"EditBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class=3D"sizeritem">
<flag>wxALL</flag>
<border>5</border>
<option>0</option>
<object class=3D"wxButton" name=3D"button_1"
base=3D"EditButton">
<label>button_1</label>
</object>
</object>
</object>
</object>
</object>
<object class=3D"sizeritem">
<flag>wxEXPAND</flag>
<border>0</border>
<option>1</option>
<object class=3D"wxGrid" name=3D"grid_1" base=3D"EditGrid">
<rows_number>10</rows_number>
<columns>
<column size=3D"-1">A</column>
<column size=3D"-1">B</column>
<column size=3D"-1">C</column>
</columns>
<selection_mode> wxGrid.wxGridSelectCells
</selection_mode>
<enable_grid_lines>1</enable_grid_lines>
<enable_grid_resize>1</enable_grid_resize>
<enable_editing>1</enable_editing>
<create_grid>1</create_grid>
<enable_row_resize>1</enable_row_resize>
<enable_col_resize>1</enable_col_resize>
</object>
</object>
</object>
</object>
</application>
Generated .PY file :
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
# generated by wxGlade 0.6.1 on Wed Dec 26 08:55:16 2007
import wx
import wx.grid
# begin wxGlade: extracode
# end wxGlade
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] =3D
wx.CAPTION|wx.CLOSE_BOX|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX|wx.SYSTEM_MENU|wx.R=
ESIZE_BORDER|wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN
wx.Frame.__init__(self, *args, **kwds)
self.panel_1 =3D wx.Panel(self, -1)
self.text_ctrl_1 =3D wx.TextCtrl(self, -1, "", style=3Dwx.TE_MULTIL=
INE)
self.button_1 =3D wx.Button(self.panel_1, -1, "button_1")
self.grid_1 =3D wx.grid.Grid(self, -1, size=3D(1, 1))
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: MyFrame.__set_properties
self.SetTitle("frame_1")
self.grid_1.CreateGrid(10, 3)
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_1 =3D wx.BoxSizer (wx.VERTICAL)
sizer_2 =3D wx.BoxSizer(wx.HORIZONTAL)
sizer_1.Add(self.text_ctrl_1, 0, wx.EXPAND, 0)
sizer_2.Add(self.button_1, 0, wx.ALL, 5)
self.panel_1.SetSizer(sizer_2)
sizer_1.Add( self.panel_1, 0, wx.EXPAND, 0)
sizer_1.Add(self.grid_1, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade
# end of class MyFrame
if __name__ =3D=3D "__main__":
app =3D wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 =3D MyFrame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
app.MainLoop()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200712=
26/d776ff4e/attachment.htm
More information about the wxpython-users
mailing list