Código Python:
Ver originalimport wx
class foco(wx.Frame):
#--------------------------------------------------------------------------------
#Constructor principal
def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY,
"Foco", size=(300, 400))
self.InitUI()
self.Centre()
self.Show()
# Construccion de la GUI
def InitUI(self):
panel = wx.Panel(self, style=wx.TAB_TRAVERSAL)
vbox = wx.BoxSizer(wx.VERTICAL)
hbox = wx.BoxSizer(wx.HORIZONTAL)
st1 = wx.StaticText(panel, -1,label='Nombre: ')
self.tc1 = wx.TextCtrl(panel, -1, size=(100, -1))
self.tc1.SetFocus()
hbox.Add(st1)
hbox.Add(self.tc1, flag = wx.LEFT, border = 10)
vbox.Add(hbox, flag=wx.LEFT | wx.TOP, border=40)
vbox.Add((-1, 10))
hbox2 = wx.BoxSizer(wx.HORIZONTAL)
st2 = wx.StaticText(panel,-1, label=u"Nombre 2: ")
self.tc2 = wx.TextCtrl(panel, -1, size=(100,-1))
hbox2.Add(st2)
hbox2.Add(self.tc2, flag=wx.LEFT, border=25)
vbox.Add(hbox2, flag=wx.LEFT | wx.TOP, border=40)
vbox.Add((-1,10))
hbox3 = wx.BoxSizer(wx.HORIZONTAL)
st3 = wx.StaticText(panel, -1, label=u"Nombre 3: ")
self.tc3 = wx.TextCtrl(panel, -1, size=(100, -1))
hbox3.Add(st3)
hbox3.Add(self.tc3, flag=wx.LEFT, border=20)
vbox.Add(hbox3, flag=wx.LEFT | wx.TOP | wx.BOTTOM, border=40)
vbox.Add((-1,10))
panel.SetSizer(vbox)
self.tc1.MoveAfterInTabOrder(self.tc3)
self.tc2.MoveAfterInTabOrder(self.tc1)
self.tc3.MoveAfterInTabOrder(self.tc2)
#----------------------------------------------------------------------
# Run the program
if __name__ == "__main__":
app = wx.App(False)
frame = foco()
app.MainLoop()
Los controles deben ir dentro del panel.