Re: perl Tk question
Hi, You are deleting whatever is in $text0 till the énd'. Comment that out and you will see all the values of $i. ... sub prg{ for (my $i=0;$i<20;$i++){ # $text0->delete('0.0','end');# commented out $text0->insert('end',"$i\n"); # sleep 1; } } Bye, Zeray |-+-> | | | | | | | | | | | | | | | | |[EMAIL PROTECTED] | | | | | |Sent by: | | |[EMAIL PROTECTED]| | |.com | | | | | |2005-06-01 10:06 AM | | |Please respond to synoptic | |-+-> >--| | | | To: perl-win32-users@listserv.ActiveState.com | | cc: (bcc: Zeray Abraha/WLR/SC/PHILIPS) | | Subject:perl Tk question | | | | Classification: | | | | | >--| Hi All! In the following snippet: use strict; use Tk; require Tk::LabFrame; my $top = new MainWindow; my $bar=$top->LabFrame(-label => 'buttons bar'); $bar->pack; my $exi=$bar->Button(-command=>\&exi,-text=>'exit'); $exi->pack(-side=>'left'); my $prg=$bar->Button(-command=>\&prg,-text=>'prg'); $prg->pack(-side=>'left'); my $fr=$top->LabFrame(); $fr->configure(-height=>'5',-width=>"30"); $fr->pack(-fill=>'none'); my $text0=$fr->Text(); $text0->configure(-height=>'10',-width=>"20"); $text0->pack(-side=>'top',-fill=>'none'); MainLoop; sub exi{ $top->destroy; } sub prg{ for (my $i=0;$i<20;$i++){ $text0->delete('0.0','end'); $text0->insert('end',"$i\n"); sleep 1; } } When executing this snippet I see in text0 only the last $i /in for cycle/ What I must add to prg code in order to see all cosequtive values of $i ? ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: perl Tk question
Here you go I took out your sleep and added a timer. Sleep will block tk handling events. The built in timer will not be blocked. So you will be able to do things like refresh the gui and move the window around the screen, etc. The '$top->update' is probably not required I just added it to force an update. Good thing about the timer, it handles starting and stopping a reaction to an event for you. Just remember to trip the alarm. Otherwise when your problem should end it will appear to hang. The bad thing is, I think that there is only one timer. I could be wrong but I do not think there is more than one. -Darian use strict; use Tk; require Tk::LabFrame; my $top = new MainWindow; my $bar=$top->LabFrame(-label => 'buttons bar'); $bar->pack; my $exi=$bar->Button(-command=>\&exi,-text=>'exit'); $exi->pack(-side=>'left'); my $prg=$bar->Button(-command=>\&prg,-text=>'prg'); $prg->pack(-side=>'left'); my $fr=$top->LabFrame(); $fr->configure(-height=>'5',-width=>"30"); $fr->pack(-fill=>'none'); my $text0=$fr->Text(); $text0->configure(-height=>'10',-width=>"20"); $text0->pack(-side=>'top',-fill=>'none'); my $alarm = 0;# added my $counter = 0; # added my $counting = 0; # added my $id; # added MainLoop; sub exi{ if($counting) { $alarm++; } # added $top->destroy; } sub prg{ $counter = 0; # added $counting = 1; # added $id = $top->repeat(500, \&Timer); # added $top->waitVariable($alarm); # added $top->afterCancel($id); # added #for (my $i=0;$i<20;$i++){ # $text0->delete('0.0','end'); # $text0->insert('end',"$i\n"); # sleep 1; #} } # added new function sub Timer { $text0->delete('0.0', 'end'); $text0->insert('end',sprintf("%02d", $counter++)); $top->update; if($counter > 20) { $alarm++; $counting=0; }; } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 3:07 AM To: perl-win32-users@listserv.ActiveState.com Subject: perl Tk question Hi All! In the following snippet: use strict; use Tk; require Tk::LabFrame; my $top = new MainWindow; my $bar=$top->LabFrame(-label => 'buttons bar'); $bar->pack; my $exi=$bar->Button(-command=>\&exi,-text=>'exit'); $exi->pack(-side=>'left'); my $prg=$bar->Button(-command=>\&prg,-text=>'prg'); $prg->pack(-side=>'left'); my $fr=$top->LabFrame(); $fr->configure(-height=>'5',-width=>"30"); $fr->pack(-fill=>'none'); my $text0=$fr->Text(); $text0->configure(-height=>'10',-width=>"20"); $text0->pack(-side=>'top',-fill=>'none'); MainLoop; sub exi{ $top->destroy; } sub prg{ for (my $i=0;$i<20;$i++){ $text0->delete('0.0','end'); $text0->insert('end',"$i\n"); sleep 1; } } When executing this snippet I see in text0 only the last $i /in for cycle/ What I must add to prg code in order to see all cosequtive values of $i ? ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: perl Tk question
[EMAIL PROTECTED] wrote: > Hi All! > In the following snippet: > > use strict; > use Tk; > require Tk::LabFrame; > my $top = new MainWindow; > my $bar=$top->LabFrame(-label => 'buttons bar'); > $bar->pack; > my $exi=$bar->Button(-command=>\&exi,-text=>'exit'); > $exi->pack(-side=>'left'); > my $prg=$bar->Button(-command=>\&prg,-text=>'prg'); > $prg->pack(-side=>'left'); > my $fr=$top->LabFrame(); > $fr->configure(-height=>'5',-width=>"30"); > $fr->pack(-fill=>'none'); > my $text0=$fr->Text(); > $text0->configure(-height=>'10',-width=>"20"); > $text0->pack(-side=>'top',-fill=>'none'); > MainLoop; > sub exi{ > $top->destroy; > } > sub prg{ > for (my $i=0;$i<20;$i++){ > $text0->delete('0.0','end'); > $text0->insert('end',"$i\n"); > sleep 1; > } > } > > When executing this snippet > I see in text0 only the last $i /in for cycle/ > What I must add to prg code > in order to see all cosequtive values of $i ? I believe it's becuase you're not getting back to MainLoop to update the display. You could put the prg sub on a timer and handle it that way or force a screen update with '$text0->update;' in the prg loop. -- ,-/- __ _ _ $Bill LuebkertMailto:[EMAIL PROTECTED] (_/ / )// // DBE CollectiblesMailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_http://dbecoll.tripod.com/ (My Perl/Lakers stuff) ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: perl Tk question
Looks like it's just because the window doesn't update until you return from the callback. Are you trying to create some sort of special effect? Perhaps asking how to create that effect might be simpler - the Text widget doesn't look like it likes that sort of thing! Kind regards, Mark Anderson Service Improvement Programme Level 2, 113 Dundas Street Edinburgh, EH3 5DE Tel: 0131 523 8786 Mob: 07808 826 063 > -Original Message- > From: [EMAIL PROTECTED] > [SMTP:[EMAIL PROTECTED] > Sent: Wednesday, June 01, 2005 9:07 AM > To: perl-win32-users@listserv.ActiveState.com > Subject: perl Tk question > > *** WARNING : This message originates from the Internet *** > > Hi All! > In the following snippet: > > use strict; > use Tk; > require Tk::LabFrame; > my $top = new MainWindow; > my $bar=$top->LabFrame(-label => 'buttons bar'); > $bar->pack; > my $exi=$bar->Button(-command=>\&exi,-text=>'exit'); > $exi->pack(-side=>'left'); > my $prg=$bar->Button(-command=>\&prg,-text=>'prg'); > $prg->pack(-side=>'left'); > my $fr=$top->LabFrame(); > $fr->configure(-height=>'5',-width=>"30"); > $fr->pack(-fill=>'none'); > my $text0=$fr->Text(); > $text0->configure(-height=>'10',-width=>"20"); > $text0->pack(-side=>'top',-fill=>'none'); > MainLoop; > sub exi{ > $top->destroy; > } > sub prg{ > for (my $i=0;$i<20;$i++){ > $text0->delete('0.0','end'); > $text0->insert('end',"$i\n"); > sleep 1; > } > } > > When executing this snippet > I see in text0 only the last $i /in for cycle/ > What I must add to prg code > in order to see all cosequtive values of $i ? > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB The Royal Bank of Scotland plc is authorised and regulated by the Financial Services Authority and represents The Royal Bank of Scotland Marketing Group. The Bank sells life policies, collective investment schemes and pension products and advises only on the Marketing Group's range of these products and on a With-Profit Bond produced by Norwich Union Life (RBS) Limited. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: perl Tk question
> When executing this snippet > I see in text0 only the last $i /in for cycle/ > What I must add to prg code > in order to see all cosequtive values of $i ? for (my $i=0;$i<20;$i++){ #$text0->delete('0.0','end'); # just don't delete everytime all contents of the box $text0->insert('end',"$i\n"); } Regards, Jan Blaha ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: perl Tk question
Just add: $top->update any place inside the "prg" procedure. On Wed, 1 Jun 2005 08:06:42 UT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi All! > In the following snippet: > > use strict; > use Tk; > require Tk::LabFrame; > my $top = new MainWindow; > my $bar=$top->LabFrame(-label => 'buttons bar'); > $bar->pack; > my $exi=$bar->Button(-command=>\&exi,-text=>'exit'); > $exi->pack(-side=>'left'); > my $prg=$bar->Button(-command=>\&prg,-text=>'prg'); > $prg->pack(-side=>'left'); > my $fr=$top->LabFrame(); > $fr->configure(-height=>'5',-width=>"30"); > $fr->pack(-fill=>'none'); > my $text0=$fr->Text(); > $text0->configure(-height=>'10',-width=>"20"); > $text0->pack(-side=>'top',-fill=>'none'); > MainLoop; > sub exi{ > $top->destroy; > } > sub prg{ > for (my $i=0;$i<20;$i++){ > $text0->delete('0.0','end'); > $text0->insert('end',"$i\n"); > sleep 1; > } > } > > When executing this snippet > I see in text0 only the last $i /in for cycle/ > What I must add to prg code > in order to see all cosequtive values of $i ? > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > -- Un saludo, # David TV E-Mail: [EMAIL PROTECTED] # ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: perl Tk question
Well right now ur deleting all the text before inserting any more. Get rid of the delete line or move it out of the for loop. Then it'll work as expected. At 08:06 AM 6/1/05 UT, [EMAIL PROTECTED] wrote: >sub prg{ > for (my $i=0;$i<20;$i++){ > $text0->delete('0.0','end'); > $text0->insert('end',"$i\n"); > sleep 1; > } > } > >When executing this snippet >I see in text0 only the last $i /in for cycle/ >What I must add to prg code >in order to see all cosequtive values of $i ? -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede males" 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Perl TK question
Win32::InternetExplorer::Window Regards Marty - Original Message - From: "Tillman, James" <[EMAIL PROTECTED]> To: "'Martin Moss'" <[EMAIL PROTECTED]>; "Jack" <[EMAIL PROTECTED]>; "Perl-Win32-Users" <[EMAIL PROTECTED]> Sent: Wednesday, June 26, 2002 12:40 PM Subject: RE: Perl TK question > Marty: What's the IE embedding module for Tk? Do you remember? I'd be > really interested in seeing that! > > jpt > > > -Original Message- > > From: Martin Moss [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, June 26, 2002 7:32 AM > > To: Jack; Perl-Win32-Users > > Subject: Re: Perl TK question > > > > > > You could always launch an external browser? use Win32::Process > > With the url entered in the text box. > > there is also a set of modules around which allow you to > > embed an internet > > explorer browser in your app -it wasn't quite fully working > > when I last > > looked at it 8 months ago though:-( > > > > Marty > > - Original Message - > > From: "Jack" <[EMAIL PROTECTED]> > > To: "Perl-Win32-Users" <[EMAIL PROTECTED]> > > Sent: Wednesday, June 26, 2002 5:36 AM > > Subject: Re: Perl TK question > > > > > > > - Original Message - > > > From: "Kevin" <[EMAIL PROTECTED]> > > > To: "Perl-Win32-Users" <[EMAIL PROTECTED]> > > > Sent: Tuesday, June 25, 2002 1:08 PM > > > Subject: Perl TK question > > > > > > > > > > I basically need to develop a small application that will > > have a textbox > > to > > > > enter a URL which will be loaded in a browser component > > inside of the > > > > application (IE component - can I use activeX?). When > > minimized, the > > > > application will run on the system tray. > > > > > > > > Is this possible with Perl/TK? > > > > > > Not without a lot of hassle ! I don't know much about > > Win32::GUI - but I > > would > > > suggest it is the better route this time around. There is no 'true' > > browser like > > > features in any Tk module that I know of. There was one > > written by Nick > > > Ing-Simmons(I think back in 1999). I have not used it - but > > it only had > > the > > > basics. > > > > > > A bonus with using Win32::GUI is the notifyicon (aka > > systray) stuff is > > built in > > > (although to have it 'removed' from the taskbar ?still > > might take some > > > Win32::API magic?). > > > > > > Jack > > > ___ > > > Perl-Win32-Users mailing list > > > [EMAIL PROTECTED] > > > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > > > > > > ___ > > Perl-Win32-Users mailing list > > [EMAIL PROTECTED] > > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > > ___ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl TK question
Marty: What's the IE embedding module for Tk? Do you remember? I'd be really interested in seeing that! jpt > -Original Message- > From: Martin Moss [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 26, 2002 7:32 AM > To: Jack; Perl-Win32-Users > Subject: Re: Perl TK question > > > You could always launch an external browser? use Win32::Process > With the url entered in the text box. > there is also a set of modules around which allow you to > embed an internet > explorer browser in your app -it wasn't quite fully working > when I last > looked at it 8 months ago though:-( > > Marty > - Original Message - > From: "Jack" <[EMAIL PROTECTED]> > To: "Perl-Win32-Users" <[EMAIL PROTECTED]> > Sent: Wednesday, June 26, 2002 5:36 AM > Subject: Re: Perl TK question > > > > - Original Message - > > From: "Kevin" <[EMAIL PROTECTED]> > > To: "Perl-Win32-Users" <[EMAIL PROTECTED]> > > Sent: Tuesday, June 25, 2002 1:08 PM > > Subject: Perl TK question > > > > > > > I basically need to develop a small application that will > have a textbox > to > > > enter a URL which will be loaded in a browser component > inside of the > > > application (IE component - can I use activeX?). When > minimized, the > > > application will run on the system tray. > > > > > > Is this possible with Perl/TK? > > > > Not without a lot of hassle ! I don't know much about > Win32::GUI - but I > would > > suggest it is the better route this time around. There is no 'true' > browser like > > features in any Tk module that I know of. There was one > written by Nick > > Ing-Simmons(I think back in 1999). I have not used it - but > it only had > the > > basics. > > > > A bonus with using Win32::GUI is the notifyicon (aka > systray) stuff is > built in > > (although to have it 'removed' from the taskbar ?still > might take some > > Win32::API magic?). > > > > Jack > > ___ > > Perl-Win32-Users mailing list > > [EMAIL PROTECTED] > > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > > > ___ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Perl TK question
You could always launch an external browser? use Win32::Process With the url entered in the text box. there is also a set of modules around which allow you to embed an internet explorer browser in your app -it wasn't quite fully working when I last looked at it 8 months ago though:-( Marty - Original Message - From: "Jack" <[EMAIL PROTECTED]> To: "Perl-Win32-Users" <[EMAIL PROTECTED]> Sent: Wednesday, June 26, 2002 5:36 AM Subject: Re: Perl TK question > - Original Message - > From: "Kevin" <[EMAIL PROTECTED]> > To: "Perl-Win32-Users" <[EMAIL PROTECTED]> > Sent: Tuesday, June 25, 2002 1:08 PM > Subject: Perl TK question > > > > I basically need to develop a small application that will have a textbox to > > enter a URL which will be loaded in a browser component inside of the > > application (IE component - can I use activeX?). When minimized, the > > application will run on the system tray. > > > > Is this possible with Perl/TK? > > Not without a lot of hassle ! I don't know much about Win32::GUI - but I would > suggest it is the better route this time around. There is no 'true' browser like > features in any Tk module that I know of. There was one written by Nick > Ing-Simmons(I think back in 1999). I have not used it - but it only had the > basics. > > A bonus with using Win32::GUI is the notifyicon (aka systray) stuff is built in > (although to have it 'removed' from the taskbar ?still might take some > Win32::API magic?). > > Jack > ___ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Perl TK question
I'd suggest using Win32::GUI if your running on Win32 platforms. I'd also suggest becoming familiar with win32::API. There is a module that can import ActiveX but I'm not remembering the name of it. A search in the Win32::GUI list at source forge for ActiveX should bring it up. When I last played with it, it was still very, very new and "imbedding" the control in my window was rather not what I expected. I'm sure you *can* do what you want in TK...if I recall correctly there was some people working on a browser component for Tk...a look in groups.google.com for comp.lang.perl.tk might prove helpful. hth, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Kevin Sent: Tuesday, June 25, 2002 2:09 PM To: Perl-Win32-Users Subject: Perl TK question Hello, I do not know much about the Perl/TK and before I begin learning it, I would like to make sure it can do what I need. The application will be for Win32 platforms. I basically need to develop a small application that will have a textbox to enter a URL which will be loaded in a browser component inside of the application (IE component - can I use activeX?). When minimized, the application will run on the system tray. Is this possible with Perl/TK? thanks --Kevin [EMAIL PROTECTED] ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs