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)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|