http://www.perlmonks.org?node_id=266105

I often hear monks explaining that Perl/Tk's interface is outdated, or that it's "Motif-like." While I have nothing against these monks, I feel it my duty as a Perl/Tk user to point out that this just isn't true. Perl/Tk's default interface can be easily customized to remedy this.

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);
Assuming $mw represents your main window, all of your Tk windows and widgets will take on a MUCH more modern appearance. Of course, you can tweak these values to fit your needs.

BTW, would it make sense to include something like this in the core of the next Tk so that new Tk programmers don't become disappointed with the default Tk interface?

Just a thought.

Bill Atkins
milkbone = perl + tk + instant messaging

Replies are listed 'Best First'.
Re: Perl/Tk doesn't look that bad
by webfiend (Vicar) on Jun 16, 2003 at 09:28 UTC

    Good advice overall. Bear in mind that there might be some differences between platforms. I think people are right to complain about the default look of Tk - it's ugly, no doubt about it. I like it, though. Tk is quick, simple, and available on practically every platform. I think there's a watch around here somewhere that can do Tk.

    Anyways, the point I think I was trying to make: Perl/Tk on Win32 looks different than Perl/Tk on X11. Fiddling with the settings might not look as good on each platform.

    Also remember that experienced users may have already adjusted their configurations a bit. I usually stick with the default look and feel. Less for me to remember. But don't let my laziness stop you from making Perl/Tk show an attractive appearance :-)

Re: Perl/Tk doesn't look that bad
by MarkM (Curate) on Jun 16, 2003 at 04:40 UTC

    I always thought Perl/Tk looking Athena-like, not Motif-like... :-)

    It is easy to under-estimate the simplicity/power of Tk. People focus on the exact look and feel, and miss out on the interface, portability, and ease of implementation.

    Personally, I don't prefer the look of Tk either, but that isn't a major factor in my mind.

Re: Perl/Tk doesn't look that bad
by Courage (Parson) on Jun 17, 2003 at 12:27 UTC
    Speaking of Tcl/Tk (without perl), it is not that outdated, as long as there are quite frequent releases.
    I heard they're planning to include more OS-native widgets into next Tcl/Tk release (including dorpdown boxes on Windows).

    perlTk could be outdated, but there exists experimental release Tk804.024 now, and it is Unicode-aware. Not as stable as 800.024 though.

    There exists an option to use Tcl::Tk modules instead and get use of most recent Tcl/Tk
    See my topics at Tcl::Tk and Tcl versions 0.6 released... and Perl could do Tcl/Tk with full Unicode support... for details.

    Courage, the Cowardly Dog

      I just took a look at that and it seems kinda nice. I'd heard of it before, but always assumed that you had to feed it Tcl code to evaluate. The interface is actually fairly similar to Perl/Tk. Thanks, man!
        I should redirect your thanks to Malcolm Beattie, the original author of module, but for some reason he is not reachable.

        Besides, to get most benefits from that module you should know some Tcl programming, but this piece of knowledge is not that much and, IMHO, not more than perlTk knowledge, and good documentation should cover this problem.

        perlTk hides widget paths from user (but hides them not completely, user still should know them if (s)he go deeply into perlTk details), as opposed to Tcl::Tk module where widget paths should be specified directly.

        Anyway, I hope soon I'll release quite stable release.

        Courage, the Cowardly Dog

Re: Perl/Tk doesn't look that bad
by bobdeath (Scribe) on Jun 17, 2003 at 15:26 UTC
    I agree that Perl/Tk doesn't look all that great. What really bothers me about it though is the fact that it is not thread safe. I hear they are trying to fix this, but for now I personally like Perl/GTk. It is thread safe, and I think it has a cleaner look
      Well, that depends on your definition of thread-safe. It is possible to have Tk running in a multiple-threaded application, as long as you restrict Tk usage to one thread.
      milkbone - perl/tk instant messaging - it's the only way to fly
Re: Perl/Tk doesn't look that bad
by Anonymous Monk on Jun 17, 2003 at 15:02 UTC
    Who cares what it looks like - it is perfectly functional and better still gets the job done. What more does anyone need?
      Well, most end-users care a lot about what it looks like. People get pretty picky about that kind of thing. And now you don't have to worry about it, because I've solved that problem. Yay me. ;)