[Tkinter-discuss] Adding <Command-Button-1> to a Listbox

Michael Lange klappnase at web.de
Tue May 26 20:23:53 CEST 2009


Hi Bob,

On Tue, 26 May 2009 10:31:26 -0600
Bob Greschke <bob at passcal.nmt.edu> wrote:

> I'd like to add <Command-Button-1> (i.e. use the Command key on a
> Mac) event handling to a Listbox so that it behaves just like the
> <Control- Button-1> "built-in" behavior (selecting/deselecting
> individual items when the selectmode is EXTENDED).  What should the
> bind statement call to do that?   Can it be done through something
> like an option_add so it applies to all listboxes in an application?
> 

I think

    root = Tk()
    root.bind_class('Listbox', '<Command-Button-1>', root.bind_class('Listbox', '<Control-Button-1>') )

should do the trick.

Regards

Michael

> Thanks!
> 
> Bob
> 
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss


More information about the Tkinter-discuss mailing list