Tk is antiquated (no antialiasing [1]) and has a poor look on Linux. It lacks functionality in widgets such as embedding a progressbar in a tree/list (don't remember) widget, which Qt supports. Also, poor font rendering support. (doesn't render Devanagari and probably CJK scripts). It feels like a 10 year old tech which it is.
(1) Maybe there is some option for it somewhere, but if so, having antialiasing disabled by default is weird.
Suitability of Tcl/Tk depends on what the goal is. For some applications, like utilities, GUI access to CLI tools, form-based data entry, etc., Tk is fine. It isn't a good option for a sophisticated drawing program, and I would try to use it for a full-bore word processor.
Within its domain, Tk is a very capable tool that easy to use, well-documented, versatile and relatively bug-free.
Future versions are planned to acquire antialiasing and other improvements, no doubt it will be a while before it's available.
I don't understand how anyone can assume that antialiasing is missing in Tk, it's simply wrong and has been there for many years for font drawing. On Linux, it must be compiled against fontconfig/xft (default, if the headers can be found). On OSX and Windows, it uses the native font renderer. The only point on OSX high dpi displays: you need to set a property that the application supports high dpi (in a .plist file), but this holds for any App-bundle on OSX. Antialiasing on a canvas (as opposed to text in labels, buttons etc.) is only enabled in OSX by default. tkpath replaces the default canvas with a more complete implementation (alpha blending, gradients, antialiasing...) on all 3 platforms.
Thanks so much for this! I know very little about Tk.
Besides antialiasing on a canvas, does antialiasing also work in text in labels, buttons, etc? Can I get in Tk all the fonts I can get in a Mac? Is Helvetica there?
But I did not say that. In the reply to the comment you've linked you
write that "this thread believes Tk is as good as QT". I am puzzled by
this conclusion because I do not see any comparison to Qt at all.
Certainly, I didn't want to suggest any with my comments.
If you want to know
my option on how Tk compares to Qt, I currently believe that, for the most part, they serve different use cases, with some overlap in the middle. Tk is better than Qt in one area (roughly: small-to-medium applications developed by a lone hacker ASAP) and Qt is better than Tk in another (roughly: medium-to-large applications developed by a team on some sort of a schedule).
Qt does a lot more than Tk. It comes with more features, e.g., networking abstractions.
Compared to it, Tk is limited. Qt looks better, too — much better on *nix.
I would not recommend Tk over Qt in the general, catch-all,
could-become-a-kitchen-sink-application case. (In
fact, working well in the general case seems to be a major selling
point for Qt.) If you develop one, chances are you will find yourself
wanting to do something that Tk can't. In other words, I would expect a
large application to outgrow Tk before it outgrows Qt.
I recommended Tk specifically for making a GUI quickly. It is good for
prototyping and rapid iteration and has neat widgets like canvas and the
text editor that help a lot with that. Tcl with Tk is expressive, so you can do a
lot in under 1000 lines of code (toy example: [1]). The
Tcl REPL helps more still, as does a great binary deployment story. After the prototype or MVP, once you understand what you want to do better,
you may stay with Tk if you decide it suits your needs or switch to
something else.
>Is there anything Tk can't do?
That is a very open-ended question. One thing that comes to mind is
integrating with the host platform's accessibility features. Most
cross-platform GUI toolkits suck at it. There is a wishlist wiki page
[2] that might offer some hints at what other things Tk
users find missing.
>Does Tk make it possible to use webfonts I see on websites?
> I recommended Tk specifically for making a GUI quickly. It is good for prototyping and rapid iteration and has neat widgets like canvas and the text editor that help a lot with that. Tcl with Tk is expressive, so you can do a lot in under 1000 lines of code (toy example: [1]). The Tcl REPL helps more still, as does a great binary deployment story. After the prototype or MVP, once you understand what you want to do better, you may stay with Tk if you decide it suits your needs or switch to something else.
Actually, I would argue the opposite. I found it easy to create GUIs using Qt Designer and to use connect() to bind functionality together. (Albeit, this was with Python, it might be harder in C++).
> widgets like canvas and the text editor
Is there something particularly unique in Tk's canvas and text editor?
Tk is 25-year-old tech, not 10. ;-) It has also maintained backwards compatibility since 1997 or so, which is a nice feature to have in many cases but comes at a price. For example, you have to know to use a "ttk::button", not a plain "button", to get the native (Windows, macOS) or a least the somewhat better-looking (*nix) widget. The result is that old Tk software still runs unchanged instead of forcing its maintainers to upgrade, but it looks bad and outdated, contributing negatively to Tk's general image.
The poor look on Linux is definitely a big downside. You can ameliorate it somewhat with a custom theme [1] but your GUI will still look out of place in any major desktop environment. TileGTK and TileQt [2] aren't maintained.
I haven't used it myself, but Tk has at least some CJK support [3]. One thing to keep in mind from the start, though, is that Tcl/Tk suffers from a UTF-16 code unit limitation similar to Java's; it only handles the Basic Multilingual Plane [4] natively.
As for antialiasing, what do you mean when you say it is disabled by default? Is that in a particular Linux distribution? A recent Tk release (post-Tcl 8.5) should render antialiased text unless you compile it with "--disable-xft" or your font is raster.
> As for antialiasing, what do you mean when you say it is disabled by default? Is that in a particular Linux distribution? A recent Tk release (post-Tcl 8.5) should render antialiased text unless you compile it with "--disable-xft" or your font is raster.
Sorry, I was thinking about antialiased drawings (canvas). Text was antialiased if I remember correctly.
IIRC Tk only has linear gradients, no fancy gradients that is needed to make your GUI look good.
(1) Maybe there is some option for it somewhere, but if so, having antialiasing disabled by default is weird.