[wxPython] Capturing text from wxTextCtrl

Thanks to all that have contributed to this very informative
thread, it has cleared a few concepts in my mind that I did not
quite understand before. But, I have a further question.
I am now working on a program that puts out a big Frame/Panel with
a few Text Control input fields, some Combo Boxes, and a Save
button. I now know how to construct a List with the values
typed and selected in the input fields and boxes to Insert into
a MySQL table. Based on this thread, the easiest way to do this is
inside the EVT_BUTTON handler corresponding to the Save button.
But my question is: before this thread, I had defined some EVT_TEXT
EVT_CHAR, EVT_COMBOBOX that are not really helpful now. Can I completely
remove these handlers from my program, or do I have to somehow process
those events? I see there is an event.Skip(), what is its purpose?

Thanks in advance.

Cesar Morelos

Jeff Shannon wrote:

  >This is correct. In an event-driven program (which most GUIs are), your
  >event-handlers are rarely called directly. They're called from the
"event loop",
  >which is handled internally by wxPython as part of wxApp.MainLoop().
When anything
  >of interest happens, the windowing system (whether GTK, Win32,
whatever) sends
  >events to your program's "event queue". Inside the main loop,
wxPython looks at
  >those events and, if you've registered an event handler for that event
(by calling
  >an EVT_XXX() macro), wxPython calls that event handler, passing it an
"event
  >object" (the 'event' in the parameter list above) with lots of details
about what
  >the event was and any other pertinent information. In order for the
rest of your
  >program to get any information out of an event handler, you have to
stash that
  >information somewhere yourself -- usually as an instance attribute
(self.myText).
  >A return statement wouldn't typically do any good, because you'd be
returning to

···

the internals of your event loop, not to anywhere in *your* code.

  >
  >Hope this helps to clarify things a bit... :slight_smile:
  >
  >Jeff Shannon
  >Technician/Programmer
  >Credit International

Thanks to all that have contributed to this very informative
thread, it has cleared a few concepts in my mind that I did not
quite understand before. But, I have a further question.
I am now working on a program that puts out a big Frame/Panel with
a few Text Control input fields, some Combo Boxes, and a Save
button. I now know how to construct a List with the values
typed and selected in the input fields and boxes to Insert into
a MySQL table. Based on this thread, the easiest way to do this is
inside the EVT_BUTTON handler corresponding to the Save button.
But my question is: before this thread, I had defined some EVT_TEXT
EVT_CHAR, EVT_COMBOBOX that are not really helpful now. Can I completely
remove these handlers from my program,

Probably.

or do I have to somehow process
those events? I see there is an event.Skip(), what is its purpose?

When you call event.Skip it lets the handler lookup code know that handling
of the event is not complete and that you wish for it to continue searching
for event handlers (usually the default handler.)

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!