Unbind initial bind on basic widget (text)

Peter Otten __peter__ at web.de
Sat Jun 12 09:16:34 EDT 2004


Askari wrote:

>    Do I can unbind the initial bind on basic widget? (ex.: the basic
>    widget
> Text have the bind "<Control-a>" for the return to the first caracter of
> the line; but me I don't want this!)
>    I try  'myText.unbind("<Control-a>")'    but the bind is not remove.
> :-(

I see two options.

1. Prevent the event from being propagated to the class.

def breaker(*args):
    return "break"

mytext.bind("<Control-a>", breaker)

2. Unbind the event on the class level.

mytext.unbind_class("Text", "<Control-a>")

> N.B. I wan't disabled ALL initial bind (not just the "<Control-a>")

Maybe you should just disable the widget?

mytext["state"] = "disabled"

Peter





More information about the Python-list mailing list