[Pygui] Win32 TextFields - when is self.text changed?

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Nov 6 12:11:04 CET 2010


Alex Holland wrote:

> class MyTextField(TextField):
> 	def key_down(self, event):
> 		oldtext = self.get_text()
> 		TextField.key_down(self, event)
> 		if oldtext != self.get_text():
> 			self.do_enter_action()
> 
> This works fine on Mac OS X, but not on Windows, where the value
> returned by self.get_text() doesn't seem to change following the call
> to the SuperClass.

Unfortunately, PyGUI's style of event handling clashes with the
way Windows works, and I had to do some convoluted things in the
background. One result is that calling TextField.key_down() doesn't
actually pass the event to the text field there and then. Instead
it sets a flag that results in the event being passed on to the
standard Windows event handling machinery after your event
handler returns. I'm not sure if there's much that can be done
about this, given the limitations of what pywin32 exposes.

I'll look into it and see if there's some way that I can provide
a text-changed hook.

-- 
Greg


More information about the Pygui mailing list