Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Per/Tk - text widget does not get updated

Reply
Thread Tools

Per/Tk - text widget does not get updated

 
 
MoshiachNow
Guest
Posts: n/a
 
      08-09-2006
HI,

I define the window :
my $mw = new MainWindow; # Main Window
my $frm_name = $mw -> Frame() -> pack();
my $lab1 = $frm_name -> Label(-text=>"Enter the remote hostname or
IP:") -> pack();
my $ent1 = $frm_name -> Entry() -> pack();
my $lab2 = $frm_name -> Label(-text=>"Enter the number of iterations to
run [5]:") -> pack();
my $ent2 = $frm_name -> Entry() -> pack();
my $but = $mw -> Button(-text=>"Start nettest", -command =>\&start) ->
pack(); #Text Area
$txt = $mw -> Text(-width=>70, -height=>20) -> pack();

MainLoop;
###################################
Then in subroutine "start" I write tesxt:


$txt -> delete("1.0",'end');
$txt -> insert('end',"Remote Hostname:\t$REMOTE_HOST\n");
$txt -> insert('end',"Remote IP address:\t$REMADDR\n");
$txt -> insert('end',"My IP address:\t\t$MYADDRESS\n\n");
###################################
Then later in the same sub I create a file :

open(FILE,">$FILE1");
print FILE ' ' x (100 * (1024 * 1024));
close FILE;
chmod 0777 => $FILE1;

The problem is that the text widget is not updated till the file
creation is over (couple of minutes).Printing to STDOUT at the same
time completes immediately.
Setting "$|" to "1" did not change much,as I expected to ...

Appreciate any input.

Thanks

 
Reply With Quote
 
 
 
 
MoshiachNow
Guest
Posts: n/a
 
      08-09-2006
Actualy,I now have found out that the text widget will not get updated
at all till I "return" from the "start" subroitine...
Does it mean that while the subroitine is running,I will not be able to
update the text widget ?

 
Reply With Quote
 
 
 
 
Dave
Guest
Posts: n/a
 
      08-09-2006

"MoshiachNow" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> HI,
>
> I define the window :
> my $mw = new MainWindow; # Main Window
> my $frm_name = $mw -> Frame() -> pack();
> my $lab1 = $frm_name -> Label(-text=>"Enter the remote hostname or
> IP:") -> pack();
> my $ent1 = $frm_name -> Entry() -> pack();
> my $lab2 = $frm_name -> Label(-text=>"Enter the number of iterations to
> run [5]:") -> pack();
> my $ent2 = $frm_name -> Entry() -> pack();
> my $but = $mw -> Button(-text=>"Start nettest", -command =>\&start) ->
> pack(); #Text Area
> $txt = $mw -> Text(-width=>70, -height=>20) -> pack();
>
> MainLoop;
> ###################################
> Then in subroutine "start" I write tesxt:
>
>
> $txt -> delete("1.0",'end');
> $txt -> insert('end',"Remote Hostname:\t$REMOTE_HOST\n");
> $txt -> insert('end',"Remote IP address:\t$REMADDR\n");
> $txt -> insert('end',"My IP address:\t\t$MYADDRESS\n\n");
> ###################################
> Then later in the same sub I create a file :
>
> open(FILE,">$FILE1");
> print FILE ' ' x (100 * (1024 * 1024));
> close FILE;
> chmod 0777 => $FILE1;
>
> The problem is that the text widget is not updated till the file
> creation is over (couple of minutes).Printing to STDOUT at the same
> time completes immediately.
> Setting "$|" to "1" did not change much,as I expected to ...
>
> Appreciate any input.
>
> Thanks
>


try adding a $mw->update; after your set of insert commands, I suspect that
the text is added to the widget but that the window is not being repainted
to reflect this.


 
Reply With Quote
 
MoshiachNow
Guest
Posts: n/a
 
      08-09-2006
Thanks,this was just it.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tkinter.event.widget: handler gets name instead of widget. Frederic Rentsch Python 0 07-08-2012 09:19 PM
Re: Tkinter.Text widget - how to get text cursor position? Alex9968 Python 0 03-19-2008 07:07 PM
Tkinter.Text widget - how to get text cursor position? Alex9968 Python 0 03-19-2008 05:37 PM
user interface widget: ordered selection list: do any UI library has this widget? zhangweiwu@realss.com Javascript 0 10-10-2006 01:02 AM
The value of the entry widget doesn't get updated Clara Python 4 04-20-2005 12:32 AM



Advertisments