For example the bind command:
grid [ttk::label .l -text "Starting..."]
bind .l <Enter> {.l configure -text "Moved mouse inside"}
bind .l <Leave> {.l configure -text "Moved mouse outside"}
bind .l <1> {.l configure -text "Clicked left mouse button"}
bind .l <Double-1> {.l configure -text "Double clicked"}
bind .l <B3-Motion> {.l configure -text "right button drag to %x %y"}
I know I can do something like this:
grid(ttk::label(".l", text: "Starting..."));
bind(".l","<Enter>", {".l", "configure", "-text", "Moved mouse inside"});
bind(".l","<Leave>", {".l", "configure", "-text", "Moved mouse outside"});
bind(".l","<1>", {".l", "configure", "-text", "Clicked left mouse button"});
bind(".l","<Double-1>", {".l", "configure", "-text", "Double clicked"});
bind(".l","<B3-Motion>", {".l", "configure", "-text", "right button drag to %x %y"});
or
grid(ttk::label(".l", text: "Starting..."));
bind(".l", "<Enter>", ".l configure -text \"Moved mouse inside\"");
bind(".l", "<Leave>", ".l configure -text \"Moved mouse outside\"");
bind(".l", "<1>", ".l configure -text \"Clicked left mouse button\"");
bind(".l", "<Double-1>", ".l configure -text \"Double clicked\"");
bind(".l", "<B3-Motion>", ".l configure -text \"right button drag to %x %y\"");
Is there a less ugly way?
I think you can’t pass a L function by reference because the bind command expect a Tcl script, right?