in reply to Printing -1 in a Tk Entry.

It looks like you are creating an Entry per each hash entry. Each Entry has a textvariable associated with it, which puts the value from the hash into the Entry. You then insert the same value yet again into the Entry. I think you just need to get rid of the insert statement. I tried it on this code

use Tk; use strict; my %params = ( a => [ "blah1", "hello" ], b => [ "blah2", "-1" ] ); my $mw = MainWindow->new(-title => 'Play w/form'); foreach my $key (keys(%params)){ my $entry = $mw->Entry(-textvariable=>\$params{$key}[1])->pack(); #$entry->insert('e',$params{$key}[1]); #unnecessary insert } MainLoop;

Replies are listed 'Best First'.
Re: Re: Printing -1 in a Tk Entry.
by Scarborough (Hermit) on Jun 02, 2004 at 13:37 UTC
    I've tried this and nothing appears in the Entry box. As I understand it the -textvariable=>$var asscociates the value typed in, to the variable $var but does not display it.
      Your understanding is incorrect. Take a look here.