Home > Archive > PerlTk > March 2007 > Wierd entry box behaviour, goes read only
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Wierd entry box behaviour, goes read only
|
|
| martin 2007-02-24, 4:04 am |
| I am getting some very wierd behaviour from my entry widgets. They are
going read-only on me unless they are the last widget in the form. For
example, see the following code. It creates two entries labelled "xxx"
and "yyy", but for some reason the "xxx" entry does not accept input.
If I move the OK button to the end neither accepts input.
Does anyone know what causes this?
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
my $top = MainWindow->new();
my $edit_top = $top->Toplevel();
my ($xxx, $yyy);
my $fr2 = $edit_top->Frame()->pack( '-side' => 'top', );
$fr2->Button(
'-text' => 'OK',
'-command' => sub {print STDERR "done...";
$edit_top->destroy();
}
)->pack( '-side' => 'left', );
my $fr = $edit_top->Frame()->pack( '-side' => 'top', );
$fr->Label( '-text' => "xxx:" )->pack( '-side' => 'left', );
$fr->Entry( '-width' => 60, '-textvariable' => \$xxx, )
->pack( '-side' => 'left', );
my $fr3 = $edit_top->Frame()->pack( '-side' => 'top', );
$fr3->Label( '-text' => "yyy:" )->pack( '-side' => 'left', );
$fr3->Entry( '-width' => 60, '-textvariable' => \$yyy, )
->pack( '-side' => 'left', );
MainLoop();
| |
| Ch Lamprecht 2007-02-24, 7:01 pm |
| martin wrote:
> I am getting some very wierd behaviour from my entry widgets. They are
> going read-only on me unless they are the last widget in the form. For
> example, see the following code. It creates two entries labelled "xxx"
> and "yyy", but for some reason the "xxx" entry does not accept input.
> If I move the OK button to the end neither accepts input.
>
> Does anyone know what causes this?
Your code runs fine and both entries accept input.
You can save some time using LabEntry (see below).
Also you do not need additional quotes on the LHS when using fat commas (=> ).
Christoph
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> use Tk;
> my $top = MainWindow->new();
>
> my $edit_top = $top->Toplevel();
> my ($xxx, $yyy);
> my $fr2 = $edit_top->Frame()->pack( '-side' => 'top', );
>
> $fr2->Button(
> '-text' => 'OK',
> '-command' => sub {print STDERR "done...";
> $edit_top->destroy();
> }
> )->pack( '-side' => 'left', );
>
>
> my $fr = $edit_top->Frame()->pack( '-side' => 'top', );
> $fr->Label( '-text' => "xxx:" )->pack( '-side' => 'left', );
> $fr->Entry( '-width' => 60, '-textvariable' => \$xxx, )
> ->pack( '-side' => 'left', );
$edit_top->LabEntry( -width => 60,
-textvariable => \$yyy,
-label => 'yyy:',
-labelPack => [-side =>'left'],
-bg => 'white',
) ->pack;
> MainLoop();
>
--
use Tk;use Tk::GraphItems;$c=tkinit->Canvas->pack;push@i,Tk::GraphItems->
TextBox(text=>$_,canvas=>$c,x=>$x+=70,y=>100)for(Just=>another=>Perl=>Hacker);
Tk::GraphItems->Connector(source=>$i[$_],target=>$i[$_+1])for(0..2);
$c->repeat(30,sub{$_->move(0,4*cos($d+=3.16))for(@i)});MainLoop
| |
| martin 2007-02-26, 4:06 am |
| On Feb 25, 6:20 am, Ch Lamprecht <ch.l.n...@online.de> wrote:
> martin wrote:
>
>
> Your code runs fine and both entries accept input.
Thanks, Christoph, but it works fine on Cygwin but not on my Linux
box, which is FC6 on AMD64, and the latest RPMs. Perhaps it is a 64-
bit versus 32 bit issue, or something to do with Unicode?
Thanks,
Martin
| |
|
| >
> Thanks, Christoph, but it works fine on Cygwin but not on my Linux
> box, which is FC6 on AMD64, and the latest RPMs. Perhaps it is a 64-
> bit versus 32 bit issue, or something to do with Unicode?
>
>
It works on my Athlon under GNU/Linux Edgie but it this is a 32 bit
computer not a 64 bit.
| |
| martin 2007-03-10, 8:03 am |
| I give up. I've tried everything, including recompiling from source,
and nothing works. Perl Tk is broken on my box.
| |
| Slaven Rezic 2007-03-12, 4:07 am |
| "martin" <martin.ellison@gmail.com> writes:
> I give up. I've tried everything, including recompiling from source,
> and nothing works. Perl Tk is broken on my box.
Did you try to compile the development version of Perl/Tk? There were
quite a number of bug fixes, though none fixed explicitly the entry
behavior.
Regards,
Slaven
--
Slaven Rezic - slaven <at> rezic <dot> de
Dump a Tk canvas as an xfig file:
http://search.cpan.org/search?mode=...y=Tk::CanvasFig
|
|
|
|
|