Hi
I would like to present a label showing to the user that script is working or processing something, then destroy label after script finish whatever is doing. Same concept as $mw->Busy icon.
I have got the routines, however when I call "working_on" routine, script will stop there and it will not going to execute next perl code.
Any advices how to display a label, o kind of progress bar.
Basically:
1. Main window have some options.
2. User select options an press ok.
3. Main windows dissapear.
4. Script executes some routines based on input user. Dring this processing I want show label
5. Script finish processing routines. Destroy label.
[tt]------------------------------------------------------------
Pragmas (perl 5.10.0) used :
[ul]
[li]strict - Perl pragma to restrict unsafe constructs[/li]
[/ul]
Other Modules used :
[ul]
[li]Tk[/li]
[/ul]
[/tt]
dmazzini
GSM/UMTS System and Telecomm Consultant
I would like to present a label showing to the user that script is working or processing something, then destroy label after script finish whatever is doing. Same concept as $mw->Busy icon.
I have got the routines, however when I call "working_on" routine, script will stop there and it will not going to execute next perl code.
Any advices how to display a label, o kind of progress bar.
Basically:
1. Main window have some options.
2. User select options an press ok.
3. Main windows dissapear.
4. Script executes some routines based on input user. Dring this processing I want show label
5. Script finish processing routines. Destroy label.
Code:
[url=http://perldoc.perl.org/functions/use.html][black][b]use[/b][/black][/url] [green]strict[/green][red];[/red]
[black][b]use[/b][/black] [green]Tk[/green][red];[/red]
[url=http://perldoc.perl.org/functions/my.html][black][b]my[/b][/black][/url] [blue]$mw_status[/blue][red];[/red]
[maroon]working_on[/maroon][red]([/red][red])[/red][red];[/red]
[maroon]resting_on[/maroon][red]([/red][red])[/red][red];[/red]
[url=http://perldoc.perl.org/functions/sub.html][black][b]sub[/b][/black][/url] [maroon]resting_on[/maroon][red]{[/red]
[blue]$mw_status[/blue]->[maroon]DESTROY[/maroon] [olive][b]if[/b][/olive] [maroon]Tk::Exists[/maroon][red]([/red][blue]$mw_status[/blue][red])[/red][red];[/red]
[red]}[/red]
[black][b]sub[/b][/black] [maroon]working_on[/maroon] [red]{[/red]
[black][b]my[/b][/black] [blue]$mw_status[/blue]=MainWindow->[maroon]new[/maroon][red];[/red]
[blue]$mw_status[/blue]->[maroon]overrideredirect[/maroon][red]([/red][fuchsia]1[/fuchsia][red])[/red][red];[/red]
[black][b]my[/b][/black] [blue]$percent[/blue][red];[/red]
[black][b]my[/b][/black] [blue]$width[/blue] = [fuchsia]200[/fuchsia][red];[/red]
[black][b]my[/b][/black] [blue]$height[/blue] = [fuchsia]10[/fuchsia][red];[/red]
[black][b]my[/b][/black] [blue]$xpos[/blue] = [url=http://perldoc.perl.org/functions/int.html][black][b]int[/b][/black][/url][red]([/red][red]([/red][blue]$mw_status[/blue]->[maroon]winfo[/maroon][red]([/red][red]'[/red][purple]screenwidth[/purple][red]'[/red][red])[/red]-[blue]$width[/blue][red])[/red]/[fuchsia]2[/fuchsia][red])[/red][red];[/red]
[black][b]my[/b][/black] [blue]$ypos[/blue] = [black][b]int[/b][/black][red]([/red][red]([/red][blue]$mw_status[/blue]->[maroon]winfo[/maroon][red]([/red][red]'[/red][purple]screenheight[/purple][red]'[/red][red])[/red]-[blue]$height[/blue][red])[/red]/[fuchsia]2[/fuchsia][red])[/red][red];[/red]
[blue]$mw_status[/blue]->[maroon]wm[/maroon][red]([/red][purple]geometry[/purple] => [red]"[/red][purple][blue]$width[/blue][/purple][red]"[/red].[red]"[/red][purple]x[blue]$height[/blue]+[blue]$xpos[/blue]+[blue]$ypos[/blue][/purple][red]"[/red][red])[/red][red];[/red]
[black][b]my[/b][/black] [blue]$pb[/blue]= [blue]$mw_status[/blue]->[maroon]Label[/maroon][red]([/red]
-[purple]bg[/purple] => [red]'[/red][purple]white[/purple][red]'[/red],
-[purple]fg[/purple] => [red]'[/red][purple]blue[/purple][red]'[/red],
-[purple]width[/purple] => [fuchsia]40[/fuchsia],
-[purple]justify[/purple] => [red]'[/red][purple]left[/purple][red]'[/red],
-[purple]anchor[/purple] => [red]'[/red][purple]w[/purple][red]'[/red],
[red])[/red]->[maroon]pack[/maroon][red]([/red][red])[/red][red];[/red]
[black][b]my[/b][/black] [blue]$timer[/blue] = [blue]$mw_status[/blue]->[maroon]repeat[/maroon][red]([/red][fuchsia]10[/fuchsia],\[maroon]&show_progress[/maroon][red])[/red][red];[/red]
MainLoop[red];[/red]
[black][b]sub[/b][/black] [maroon]show_progress[/maroon][red]{[/red]
[blue]$percent[/blue] += [fuchsia]1[/fuchsia][red];[/red]
[olive][b]if[/b][/olive][red]([/red][blue]$percent[/blue] >= [fuchsia]100[/fuchsia][red])[/red][red]{[/red][blue]$percent[/blue] = [fuchsia]0[/fuchsia][red]}[/red]
[black][b]my[/b][/black] [blue]$str[/blue] = [red]'[/red][purple]|[/purple][red]'[/red] x [blue]$percent[/blue][red];[/red]
[blue]$pb[/blue]->[maroon]configure[/maroon][red]([/red]-[purple]text[/purple] => [blue]$str[/blue] [red])[/red][red];[/red]
[red]}[/red]
[red]}[/red]
Pragmas (perl 5.10.0) used :
[ul]
[li]strict - Perl pragma to restrict unsafe constructs[/li]
[/ul]
Other Modules used :
[ul]
[li]Tk[/li]
[/ul]
[/tt]
dmazzini
GSM/UMTS System and Telecomm Consultant