Question

I have an application that is built to work on Windows, Linux, and Solaris that uses the Perl/TK GUI. Due to constraints, we are limited to Perl/TK only. Moreover, we are limited to an old Perl/Tk version, 5.00404.

I'd like to work within these limitations to make the GUI look as nice and modern as possible.

Are there any web-resources that have TK design schemes (for buttons, frames, colors, etc) that could assist me in this endeavor?


I am also looking for modernization advices like the one that I found here:

If you're finding that your Tk apps look a little ugly on X-based systems, try adding the following lines to the top of your script:

$mw->optionAdd("*font", "-*-arial-normal-r-*-*-*-120-*-*-*-*-*-*");
$mw->optionAdd("*borderWidth", 1);
Was it helpful?

Solution

Try using images instead of button elements, then you can have whatever style you like and the fonts can be baked in. This will work for pretty much any element where the contents are not dynamic - including backgrounds on panes and such. Granted it's more work but it does solve your problem, especially if you have a competent artist in your project group.

OTHER TIPS

You could use the Tk theme engine to give your app better looks.

Using optionAdd to tweak defaults through the option database is a reasonable start. A thread about this can be found at:

http://tcl.projectforum.com/tk/221

Download griffin.kit from there, use the sdx tool to unwrap it and locate griffin.tcl to get a good set of option settings.

http://wiki.tcl.tk/3411 for the sdx tool.

Since in Linux the background of Tk::Entry and Tk::Text is grey i would also use the following two lines.

$mw->optionAdd( '*Entry.background',   'snow1' );
$mw->optionAdd( '*Text.background',    'snow1' );

Replace 'snow1' with a color of your choice. You can also use the hex representation(RGB) of the colors like '#ff9696'.

The Tile themeable engine for Tk makes it look much prettier. However, Perl/Tk has lagged far behind Tk's development, and can't take advantage of Tile and other advancements.

You should investigate whether Tkx is an option for you. It's not completely compatible with Perl/Tk, but the API is pretty close. It's a bridge between Perl and Tcl/Tk, so it can use all of the modern Tcl/Tk features (like Tile) while still having application logic coded in Perl. Quite a few of ActiveState's own graphical utilities use Tkx, with fairly good-looking results.
ActiveState PPM
(source: activestate.com)

Perl 5.00404 is incredibly ancient, though. The Tkx dist claims to depend on Perl≥5.008... I don't have an old enough Perl to see how accurate that is.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top