On May 10, 2007, at 09:58, Kenneth Ölwing wrote:
>> The ActiveState preferred choice of Perl GUI toolkit is Tkx (or >> Tcl::Tk).>> Tkx is bundled with the latest ActivePerl releases for all 32-bit>> platforms. It does provide native look-and-feel on Windows (including>> themed widgets on WinXP) and OS X (Aqua) and does X11 on the rest >> of the>> Unix platforms.>> This statement just prompted some confusion that I'd like to take the> opportunity to hopefully resolve...>> In short, what's up with the different Tk offerings there > apparently is?
Let me try to explain then:
Tk is an extension for the Tcl runtime that provide a Tcl language
API for writing GUI applications.
Tkx is a bridge to an Tcl language interpreter that also loads the Tk
extension for you. Recent versions of ActivePerl ships with a
dynamic library (tkkit.dll) that contains the latest stable version
of the Tcl language runtime and some useful Tcl extensions including
Tk (read "perldoc Tcl::tkkit" to figure what's included). This allow
Tkx to load even if you don't have ActiveTcl or another version of
the Tcl language runtime installed on your machine. If you have a
Tcl runtime installed you can tell Tkx to connect to it by setting an
environment variable.
Perl/Tk is a binding to the Tk extension that bypass the Tcl
language. In order to achieve this it uses a modified version of the
Tk sources. This approach has the disadvantage that it's (hard) work
to update the sources to more recent versions of Tk. Because nobody
has been willing to do this work Perl/Tk has basically been frozen at
Tk version 8.4.5 for many years now with very limited access to other
Tk extensions provided by the Tcl community. One effect of this is
that Perl/Tk applications need X11 on Mac OS X and doesn't get the
native Aqua look.
Tcl::Tk is using the same bridge to Tcl as Tkx is using but tries to
maintain the Perl language source API that Perl/Tk invented. Tkx
goal was not to preserve the Perl/Tk API, but to provide a clean/
minimal API that give you direct access to the Tcl objects. Tcl::Tk
is not distributed with ActivePerl, but you can install it with ppm.
If you have an old application written for Perl/Tk it ought to be
less work to port it to Tcl::Tk than to Tkx. Your mileage may vary.
I would regard Perl/Tk as legacy code in ActivePerl. It's there to
support old applications written against that API. For new
applications Tkx is recommended as that give you access to the newest
development to the Tk code base. As Jan said Tkx is what we use to
write all the Perl GUI tools at ActiveState.
Regards,
Gisle