[Tutor] tkinter event question
Michael P. Reilly
Sat, 23 Feb 2002 17:38:42 -0500
On Sat, Feb 23, 2002 at 06:38:14PM +1100, Glen Wheeler wrote:
> > You can also use unbind_class(). Unfortunately, it affects every Text
> > widget, but it's about the only way to handle the 'default' effect.
> > There are other advantages of using Entry over Text - if you want a Tab-
> > advancing form, Entry widgets will be more friendly.
> Hmm, ok. I've converted the one-line fields where I want to bind return
> to entry-s, but for purely academic reasons (and curiosity) would creating a
> new class which inherited from Text, changed next to nothing, and then
> unbind_class()-ing that? I'm not sure, as I've never tried it but it feels
> to me like that could work. The only thing that might make it fail is that
> there is only one Text widget in tk and unbind_class may either a) not work
> on the new class which inherits from Text or b) unbind all the text widgets
Actually, these aren't Python classes, but are (X11 oriented) widget
classes. The bindings are removed inside Tk itself and have little
really to do with Tcl, Python or Perl (for Perl/Tk).