How update text in text widget when executing some other callback 
Author Message
 How update text in text widget when executing some other callback

I have a button in the top level :
command_bttn = $mw -> Button ( -text => Run,
                               -command => \$run_some_command );

The subrountine run_some_command has to do some stuff that requires
some time (like it has to copy some files from one dir to other. Delete
some files and run some more commands).

To keep the user updated to what the program is doing I have created a
text widget that displays the status_str like this :

$status_txt = $mw -> Scrolled ( Text,
                               -scrollbars => "osoe");
$status_txt -> insert (end,$status_str);

The $status_str is updated many times in the &run_some_command subroutine
that is associated with command_bttn.

sub run_some_command {
...
...
$status_str = "This job done. Checkpoint 1";
...
...
$status_str = "This job done. Checkpoint 2";
..
...
and so on.

Quote:
}

I want that the text in the text widget should be updated continiously
as the subroutine run_some_command is getting executed.
What I see is that the text in the text widget is only updated once the
run_some_command has finished executing which is not what I want as it defeats
the whole purpose of having the text widget in the first place.

Can anyone suggest something ?
Any help would be appreciated.



Sun, 24 Jul 2005 06:30:43 GMT  
 How update text in text widget when executing some other callback
Force an 'update'...as below:


Quote:
> I have a button in the top level :
> command_bttn = $mw -> Button ( -text => Run,
>                                -command => \$run_some_command );

> The subrountine run_some_command has to do some stuff that requires
> some time (like it has to copy some files from one dir to other. Delete
> some files and run some more commands).

> To keep the user updated to what the program is doing I have created a
> text widget that displays the status_str like this :

> $status_txt = $mw -> Scrolled ( Text,
>                                -scrollbars => "osoe");
> $status_txt -> insert (end,$status_str);

> The $status_str is updated many times in the &run_some_command subroutine
> that is associated with command_bttn.

> sub run_some_command {
> ...
> ...
> $status_str = "This job done. Checkpoint 1";

$status_txt->update;
Quote:
> ...
> ...
> $status_str = "This job done. Checkpoint 2";

$status_txt->update;

- Show quoted text -

Quote:
> ..
> ...
> and so on.

> }

> I want that the text in the text widget should be updated continiously
> as the subroutine run_some_command is getting executed.
> What I see is that the text in the text widget is only updated once the
> run_some_command has finished executing which is not what I want as it defeats
> the whole purpose of having the text widget in the first place.

> Can anyone suggest something ?
> Any help would be appreciated.



Sun, 24 Jul 2005 08:35:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Ev not working correctly during a callback on Text widget

2. Question on Text Widget Update

3. Question on Text Widget Update

4. Question on Text Widget Update

5. Text widget updates

6. Updating Text widget in a while() loop

7. Q: Changing Text-Color in Text-Widget?

8. text formatting in a Text widget

9. Color Coding Text in a Tk::Text Widget

10. Checking for marked or selected text in a Text widget

11. Grabbing Text from Text widget

12. Retrieving a line of text from a Text Widget when clicking on it

 

 
Powered by phpBB® Forum Software