Reputation: 25603
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.
Upvotes: 1
Views: 397
Reputation: 249
I tried C++/Tk but left that path. It does not support all of Tk, eg the featured widgets such as notebook and treelist are not supported, or you cannot pass parameters to a command. Furthermore, the implementation is quite complex and if something is not working as expected it's heavy to debug. Frustrated after a week of problem solving I decided to dump C++/Tk.
Exit C++/Tk, enters Qt (you should say "cute", but it's a bit silly, so I say "queue tee"). It has a commercial but also an open source license, there is active development going on, it is well documented with plenty of examples, it supports most desktop and mobile OSes, there is an active community with wiki and blogs, ... Besides the GUI and graphics stuff there are other modules available for multimedia, networks, SQL, testing, ...
As the development of QT started way back in 1991 (and it was part of Nokia for some time), there are some parts that are "old" and replaced by new stuff, but in contrast to Microsoft the documentation is much clearer on this. And also in contrast to Microsoft, the whole set of technologies is coherent.
For the integration with C++ there are two ways:
If you want to make a GUI you should definitely consider Qt.
Upvotes: 1
Reputation: 212
Have you tried GTK+ or QT? Well, QT mostly is a platform for development, not a GUI library, but you can try it's too.
Upvotes: 1