I have a lot experience in tcl/tk, but I want to get rid of scripting languages for large projects. But tk canvas has a very big functionality which I have to replace with a good gui toolkit.
One of the features I need is a canvas on which I can create active graphical objects. For example, I have a circle which can be moved by mouse drag like this in tk:
#!/usr/bin/wish8.5
canvas .c
pack .c
set item [.c create oval 10 10 20 20]
.c bind $item <Any-Enter> ".c itemconfig current -fill red"
.c bind $item <Any-Leave> ".c itemconfig current -fill blue"
bind .c <ButtonPress-1> "setlast %x %y"
bind .c <B1-Motion> "moveit %x %y"
set lastx 0
set lasty 0
proc setlast { x y } {
global lastx
global lasty
set lastx $x
set lasty $y
}
proc moveit { x y } {
global lastx
global lasty
.c move current [expr $x-$lastx] [expr $y-$lasty]
set lastx $x
set lasty $y
}
Any other toolkit I found needs a lot of handcrafted work for this. Typically you have to find out yourself which item on a canvas is under the mouse which is a very large amount of work for complex shapes like polygons.