I really like Perl/Tk
, but have come to the opinion that it's DOA. I think Tcl::Tk
and Tkx
are better solutions. Assume I drop Perl/Tk
. Is the "most supported" route to go with Tcl::Tk
(which hasn't been updated since 2007, and whose author seemingly cannot be reached), or Tkx
? Are either of these actively used/supported?
Under the hood both Tcl::Tk and Tkx use the Tcl module as a bridge to Tcl/Tk. The difference is in the API they present to Perl.
Tkx was developed by ActiveState, who use it in the GUI for their tools. (e.g. PPM) It's actively used, though it's hard to say how widely. It's supported as well, but because it's such a thin layer over Tcl there's not a great deal to support. In a way that's a good thing -- there's little to change or break -- but it does give the impression of abandonware.
Tcl::Tk started as a side project to demonstrate that API compatibility with Perl/Tk was possible. I love the idea of this -- it would be wonderful to only need to change use Tk
to use Tcl::Tk
and get the benefits of newer versions of Tcl/Tk like tile (theme) support. Unfortunately, it's not there yet. There seems to be some work being done, but not a lot. It could really use more developers.
Personally, I use Tkx. If you're experienced at developing in Perl/Tk the transition isn't too painful, but I think it would be a difficult place to start. The worst part is that you need to refer to the Tcl/Tk documentation in order to use it. That's great if you know Tcl as there are very few surprises introduced by the bridge to Perl, but if you don't it's awkward to translate from an unfamiliar language.
I have had good result with wxPerl, here is a short article on O'Reilly
Note: I was targeting win32 and this was about 5 years ago.
(Disclaimer: I am a maintainer of Tcl::pTk, and have submitted contributions to Perl/Tk, Tcl/Tk, Tcl::Tk, and Tkx.)
Update for 2019:
Perl/Tk has had releases in the past few years and development since then, but the maintainer admits to having insufficient time available for major improvements, such as incorporating changes from Tcl/Tk 8.5+. Anyone wanting to use features or improvements in newer Tcl/Tk versions may be interested in instead using one of the Tcl/Tk "wrapper" modules (which provide access to a full separate Tcl/Tk installation from Perl, rather than putting all of Tk in a single Perl module).
If you are working on a new project and like Perl/Tk syntax, you may be fine with Tcl::Tk, a lighter-weight wrapper which uses Perl/Tk-like syntax, while also allowing Tcl/Tk syntax. Tcl::Tk has had some maintenance in the past year.
However, if you have an existing Perl/Tk program, you may instead want to try Tcl::pTk. It's based on Tcl::Tk, but emphasizes compatibility with Perl/Tk syntax in existing programs. The Tcl::pTk::TkHijack module makes it fairly easy to try out Tcl::pTk by intercepting the
use Tk;
statements. Tcl::pTk is still a work in progress, but trying it with different programs out there helps find what else needs improvement.Or, if you are not familiar with Perl/Tk, have more familiarity with actual Tcl/Tk syntax, or familiar with wrappers for languages (e.g. Tkinter for Python), a better option might be Tkx. As Micheal Carman's answer points out, Tkx hasn't seen much maintenance since 2010, but mainly because it hasn't needed much; as improvements continue to be made to Tcl/Tk, Tkx can usually take advantage of them automatically. The language-agnostic tutorials on TkDocs.com provide examples in Tkx syntax.
I discovered Tcl::pTk last year, and have since become a maintainer for it. I mainly use it in order to use macOS' native aqua UI (instead of XQuartz like Perl/Tk uses), which is what a handful of other active users also report using it for.
来源:https://stackoverflow.com/questions/1249186/should-i-use-perl-tk-tcltk-or-tkx-for-a-perl-gui