Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^7: convert a single thread application to multithread with GUI

by zentara (Archbishop)
on Jul 12, 2007 at 12:07 UTC ( #626215=note: print w/ replies, xml ) Need Help??


in reply to Re^6: convert a single thread application to multithread with GUI
in thread convert a single thread application to multithread with GUI

Here is the basic idea, for a sliding buffer of 'x' lines:

#!/usr/bin/perl use Tk; use Tk::Text; my $mw=tkinit; my $text = $mw->Scrolled('Text')->pack; $text->bind('<Return>',[sub { &check_limit }]); $mw->Button(-text=>'Press Me', -command=>sub { $text->insert('end',$i++."\n"); $text->see('end'); &check_limit; })->pack; $mw->Button(-text=>'Exit', -command=>sub {exit})->pack; for (1..198){ $text->insert('end',$_."\n"); $text->see('end'); } MainLoop; sub check_limit{ $text->delete('1.0', "end -200 lines"); }

I'm not really a human, but I play one on earth. Cogito ergo sum a bum


Comment on Re^7: convert a single thread application to multithread with GUI
Download Code
Re^8: convert a single thread application to multithread with GUI
by ultibuzz (Monk) on Jul 12, 2007 at 13:42 UTC

    nice, but where to find suchs tuff like delete and co ?
    i checked the Tk docs and they are really basic.
    is there somewhere a good site for more detailed Tk docs and maybe some examples ?

    kd ultibuzz

      The book "Mastering Perl/Tk" is the best learning guide out there. Once you plow through that, you can search groups.google.com for snippets that have been posted before. Search for example: "Perl/Tk Text limit lines"

      There is a tagline for one of the monks here, that goes something like: "99% of the code needed has already been written"...... you just need to search google and groups.google to find it.

      I always do a groups.google.com search whenever I have a question about code or syntax..... I almost always find the answer. You will see the code I posted( original by Marc Dashevsky, in comp.lang.perl.tk )


      I'm not really a human, but I play one on earth. Cogito ergo sum a bum

        great tipp,
        i have learning perl/Tk and mastering Perl/tk at work,
        but i didn't look into mastering yet im still in the learning Book ;)

        kd ultibuzz

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://626215]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2015-07-03 21:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (56 votes), past polls