Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Perl/TK with Windows

by seeker (Curate)
on Jul 29, 2003 at 12:00 UTC ( [id://278794] : perlquestion . print w/replies, xml ) Need Help??

seeker has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks;

I have to write a Perl application (for my wife so there's no avoiding it) on a windows platform. I know almost nothing about windows and Perl. Perhaps this question will seem obvious to those who do.

I have looked at various articles here about Perl/Tk and windows, but it is not clear to me whether I need to install X on a windows machine (is this even possible?) in order to use Perl/Tk. My pervious experience was on a Linux system which already had X installed.

Thanks for you help.

Replies are listed 'Best First'.
Re: Perl/TK with Windows
by hiseldl (Priest) on Jul 29, 2003 at 12:30 UTC

    No, you do not need an X server to run Perl/Tk on windows. You can use Activstate Perl, which runs on windows and has a native port of Perl/Tk.

      I have to write a Perl application...I know almost nothing about windows and Perl.

    If you have never done any windows programming, and you want to keep things simple, then I would not recommend using wxPerl. Perl/Tk is simpler than wxPerl to implement, especially if you have not done any other GUI programming.


    What time is it? It's Camel Time!

      Perl/Tk is simpler than wxPerl to implement, especially if you have not done any other GUI programming.

      Exactly! Once you've learned Perl/Tk, you can always rewrite it to use WxPerl or Win32::GUI.

Re: Perl/TK with Windows
by crenz (Priest) on Jul 29, 2003 at 12:18 UTC

    There are X-Servers on Windows, but you don't need them for Perl/Tk. However, for Windows (and indeed any other OS ;-)) I would prefer wxPerl. It uses native widgets and so looks more Windows/Linux/MacOS-like.

    Try to search for wxWindows and wxPerl here on PerlMonks, you'll find a few tutorials for it.

      I agree with that. Tk widgets tend to look ugly (IMHO) almost everywhere. Wx has a nice native look on Windows, and a Gtk one on Unix.


Re: Perl/TK with Windows
by strat (Canon) on Jul 30, 2003 at 10:54 UTC
    As one of my precessors said, I'd use Activestate Perl (Version 806 -> .msi), because there is Tk alread integrated.

    Perl under Windows is about the same as unter Linux, if you don't rely on external programs or interfaces (but nearly all of the plattform-independend modules run fine). Under Windows, scripts are not called by the Shebang-line, but by associating the ending of the script (e.g. .pl) to perl (which is done automatically by the installer).

    For getting rid of the nasty shell-window with tk-Scripts when the script is running, I'd rename the extension to something like .ptk and associate it with wperl.exe, about like in the following (be sure to adapt paths to your perl/bin-Directory) typed in the shell (cmd.exe on winNT/2k/XP; I don't know if this also works with under Win9x/ME):

    assoc .ptk=PerlTk ftype PerlTk=c:\perl\bin\wperl.exe
    After that, you can just execute your script by double-clicking on it, or typing it's name (e.g. script.ptk in the shell).

    Some time ago, there were problems with geometry management under Win9x/ME, but not under WinNT/2k/XP. (e.g. if you resized a window) But I don't know if they have already been fixed, because I haven't written anything for Win9x/ME for ages.

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8."

Re: Perl/TK with Windows
by cored (Scribe) on Jul 29, 2003 at 12:37 UTC
    You can use the win32::gui module that comes with activestate too i think is more windows like and is quite good... keep coding