python - wxPython set selected control upon application start -
i have simple wxpython application. has image , text-entry field (a wx.textctrl
).
i want able able start entering text window opens. right now, have first click in text control, , can start entering text.
here minimal app demonstrates issue:
import wx class myframe(wx.frame): """ derive new class of frame. """ def __init__(self, parent, title): wx.frame.__init__(self, parent, title=title, size=(200, 100)) mainsizer = wx.boxsizer(wx.vertical) self.control = wx.textctrl(self, style=wx.te_multiline) mainsizer.add(self.control, 1, wx.expand) self.setsizer(mainsizer) self.show(true) app = wx.app(false) frame = myframe(none, 'small editor') app.mainloop()
i've poked around wx.setinsertionpoint
, not seem have effect.
ah, derp. had further inheritance chain.
you can call setfocus()
on control (in case, self.control.setfocus()
).
setfocus()
member function of wxwindow. looking @ docs wxtextctrl.
of course, didn't think inheritance chain until had asked question.
i'm leaving here, pretty hard google issue. else.
Comments
Post a Comment