September 7th, 2006, 05:09 PM
Wx.Python -- How do I focus a TextCtrl after a button event?
I have an interface where the user enters text into a textbox, and then presses a button or hits enter to 'submit' the data. But the user will need to be able to begin typing again immediately after this. The way I have it written now, after the submit event, the textbox is no longer in focus and you must click on it to begin typing again. Ive looked through the wxPyDocs for a way to do this, but I havent seen any methods of TextCtrl that do this. Has anyone else had this issue? Any solutions?
September 7th, 2006, 08:10 PM
If your wx.TextCtrl is called edit1, then something like self.edit1.SetFocus() should do.
Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25
September 8th, 2006, 02:34 AM
wxPython uses quite a deep inheritance heirarchy. To see everything that a control does you must remember to check the attributes on all the parent classes as well. In particular most of the visible objects derive from wxControl, which is derived from wxWindow. The wxWindow class has a huge number of methods, including setFocus.
It is worth spending some time studying the top level classes since there is a lot of functionality shared by all the controls.
September 8th, 2006, 12:34 PM
thanks I will look into that. Im new to OOP so the habits havent been developed yet, ;0) I appreciate the help