Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Perl/Tk exit trouble?

by Hengist (Pilgrim)
on Jan 09, 2010 at 20:17 UTC ( [id://816537]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl/Tk exit trouble?
in thread Perl/Tk exit trouble?

Thank you,

The Perl-Tk version is 804.027 and here is one of the scripts which misbehaves; as you can see, it's an exercise answer from one of the earlier chapters -

#!/usr/bin/perl -w # 123ex1 - Combination of Entry and Label widgets. # Another segmentation fault; that's interesting. # # Setting the Label width forces the widget to scroll, # otherwise it will expand the window x-wise to # accomodate the extra text. Try -wraplength also. use Tk; use strict; my $message; my $mw = MainWindow->new; $mw->title("Label following Entry"); $mw->Label(-textvariable => \$message, -width => 40) ->pack(-side => 'bottom', -fill => 'x',); my $e = $mw->Entry(-textvariable => \$message) ->pack(-expand => 1, -fill => 'x'); MainLoop;

I agree, the book is well out of date, but it was a cheap 'pre-loved' deal on Amazon. I've already give up on the book as a tutorial. Thanks for the advice about GTk2 - I may just follow that up.

Replies are listed 'Best First'.
Re^3: Perl/Tk exit trouble?
by zentara (Archbishop) on Jan 10, 2010 at 12:33 UTC
    The Perl-Tk version is 804.027

    ... no that is an old version, now it it 804.028

    Many bug fixes have been incorporated in the move from .027 to .028

    See Cpan's Tk.... it's easy to install


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku

      Thanks, zentara,

      I'll do that. Another monk (Thanks, stefbv) suggested I tried Gtk2 as it has greater current support, but in the brief look I took this afternoon, it's bigger, noisier and less intuitive than Perl/Tk. One of the things I love about Perl is the simplicity, and lack of unnecessary typing.

      I'm hoping that 804.028 may also help with the other bug I've uncovered; the mess made if I try to bind a key sequence involving the Ctrl key. For whatever reason, it transposes the last two characters in a Text widget; and I'm having to use the Alt key until I find a fix. Ho-hum.

      Thanks once again; I'm off to CPAN!

        Yeah Tk is far easier to learn and start out with....I would use it at as a first GUI for teaching GUI principles. The Tk::Canvas and Tk::Zinc widgets are still my first choice when wanting to write something complex. The problem with Tk is that it dosn't handle transparent colors, threads, nor themes(look and feel) very well. Gtk2 does all that.

        See a Zinc beginners tutorial


        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku
Re^3: Perl/Tk exit trouble?
by stefbv (Curate) on Jan 09, 2010 at 21:32 UTC

    No segmentation fault on my system (Slackware with Perl 5.10.0).

    the trouble may be with Tk, Perl or even the OS.

      I'm guessing it's Tk that's doing the wrong thing. I've used Perl in command-line for some weeks on this machine, and it's behaved superbly; it's only since I've started to learn Tk that the seg faults have manifested. They are probably harmless; they don't even get reported if the script is launched by a doubleclick.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://816537]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-25 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found