Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Dear Monks

I am trying to adapt my Tk program using Tcl::pTk which I find a very interesting module to revamp the use of Tk in Perl (modern interface, etc.). I could port most of my old UI and it works fine. What I am struggling with are speed issues with my icons. In standard Tk everything is quick, loading the same set of icons (png) with Tcl::pTk takes ages. As both module should be a layer on Tk, I do not quite understand the big difference (10x time in pTk). You can almost take a coffee in the time the GUI is ready.

My exosystem: Windows 10 and Activeperl 5.16 (I wasn't able to make Tcl::pTk work with Strawberryperl....).

Here a small script to make the point

use Tcl::pTk; #use Tk;#using this instead of Tcl::pTk it is 10x/20x quicker #use Tk::PNG; my $mw = MainWindow->new(); my $lab = $mw->Label(-text => "Hello world")->pack; foreach (1..30){ my $PngSettings = $mw->Photo( -file => "settings.png"); $mw->Button(-image => $PngSettings, -command => sub { $lab->configure(-text=>"[". $lab->cget('-text')."]"); }, -borderwidth => '0', )->pack(-side=>'right', -anchor => 'e', -padx=>5, -pady=>5); } MainLoop;

Am I missing something? It is a shame that it seems practically nobody is using this module as there is almost nothing out there about Tcl::pTk (besides the good POD)


In reply to Tk vs Tcl::pTk speed image by Anonymous Monk

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 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? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2021-09-23 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?