I am Teddy and I am beginner in wxPython. I have one problem pertaining to EVT_TEXT and I don’t know why I am getting it. I am trying to convert characters in text ctrl field into upper case by calling EVT_TEXT to respond whenever a character is typed in the field. But everytime I get the last insertion point, the program issues this error ‘Maximum Recursion Depth Exceeded’. First, I would like to know what exactly does this error message mean. Second, how could I avoid it. Third, is there any other way I could set the text field in upper case so I won’t need to call EVT_TEXT.
I’m trying to learn more about wxPython. Your help will be much appreaciated.
Hi,
I am Teddy and I am beginner in wxPython. I have one problem pertaining to EVT_TEXT and I don't know why I am getting it. I am trying to convert characters in text ctrl field into upper case by calling EVT_TEXT to respond whenever a character is typed in the field. But everytime I get the last insertion point, the program issues this error 'Maximum Recursion Depth Exceeded'. First, I would like to know what exactly does this error message mean.
You have created an and endless sequence of events where handling the event causes it to be sent again before the first one has returned. The 'Maximum Recursion Depth Exceeded' message means that you bumped in to the brick wall that Python imposes on nesting of function calls and stack frames.
Second, how could I avoid it.
See my other recent message about setting and checking a flag as a recursion guard.
Third, is there any other way I could set the text field in upper case so I won't need to call EVT_TEXT.
You could catch the EVT_CHAR event, get the keycode, if it is one that needs converted to upper case then convert it and insert it into the text control, otherwise call event.Skip so the default processing will be done for other types of keystrokes.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!