On Thu, Jan 13, 2005 at 09:14:54AM -0600, Jeff Epler wrote:
                        .
                        .
                        .
> You need to learn about "break" and bindings.  When you return the
> string "break" from a binding, any subsequent binding that would have
> been executed (such as the default one for inserting characters into an
> entry widget).
> 
> Here's a simple program that uses 'return "break"':
>     import Tkinter
> 
>     def modified_inserter(event):
>         event.widget.insert(Tkinter.INSERT, "b")
>         return "break"
> 
>     e = Tkinter.Entry()
>     e.bind("a", modified_inserter)
>     e.pack()
>     e.focus()
>     e.mainloop()
> It doesn't get everything right (for instance, it doesn't delete any
> selected text in the entry before inserting) but it shows the general
> principle.
                        .
                        .
                        .
An alternative approach is to use traces.  Some programmers
prefer traces on variables, some bindings on Events.
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to