Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

How many tk objects are you keeping in memory?

Are you using some kind of a virtual tree control, one that doesn't keep all objects in memory?

On my machine, Scrolled doesn't like more than ~1300 buttons, I don't care why

#!/usr/bin/perl -- use strict; use warnings; use Tk; Main( @ARGV ); exit( 0 ); sub Main { gogogo( shift || 6_200 ); } sub gogogo { my( $max ) = @_; my $mw = tkinit; for my $ix ( 1 .. 3 ){ my $button = $mw->Button( -text => "Make $max" )->pack; my $frame = $mw->Scrolled('Frame')->pack(qw/ -expand 1 -fill +both /); $button->configure( -command => [ \&makesome, $frame , $max ] +); } $mw->MainLoop; } sub makesome { my( $frame , $max ) = @_; $frame->Busy; my $button = $Tk::event->W ; $button->configure( qw/ -state disabled /); $button->update; $frame->update; my $time = time; print "$frame ( $max ) $time\n"; for my $ix( 0 .. $max ){ my $button = $frame->Button( -text => $ix )->pack; $button->configure( qw/ -state disabled /); } $frame->update; $frame->Unbusy; my $time2 = time; print "$frame ( $max ) $time2 #### $time2 - $time = @{[ $time2 - $ +time ]}\n"; return; }

But FWIW, Firefox doesn't like a lot of buttons either, and frankly, that many actual button objects is too many -- same as displaying 1000 search results, for human not to go insane, you have to pageinate

Devel::NYTprof to find bottle necks, code review to find thinko-s, and prototyping to figure out limits, try out cheap fixes... code review suspect widgets ... repeat

Why so slow when using Perl/Tk?, Tk::Table too slow. Alternatives ?, Why is wxPerl slower than Win32GUI?, Comparing Tcl::Tk and perlTk WRT speed,

Virtual grid widget, Tcl Performance / Tk Performance

Wx::Perl::ListView/Wx::Perl::ListView::SimpleModel


In reply to Re: perl tk mainwindow capability (virtual tree widget, huge amounts of data, pageination) by Anonymous Monk
in thread perl tk mainwindow capability by ghosh123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-16 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found