When I try to do the following example:
#http://habrahabr.ru/blogs/perl/65774/ use Tkx; my $mw = Tkx::widget->new('.'); #Main Window #buttons my @btns = ( $mw->new_ttk__button(-text=>'button 1'), $mw->new_ttk__button(-text=>'button 2'), $mw->new_ttk__button(-text=>'button 3') ); #Place elements (buttons) in table grid #column x row coordinates $btns[0]->g_grid(-row=>0, -column=>0); $btns[1]->g_grid(-row=>0, -column=>1); $btns[2]->g_grid(-row=>1, -column=>1); #Event Loop Tkx::MainLoop();
It gives me an error:
invalid command name "ttk::button" at "script.pl" line ##
When I add after
use Tkx;
the following:
Tkx::package_require('ttk');
It gives me an error that it cannot find the "ttk" package:
can't find package ttk at "script.pl" line ##
Either way, I tried to capitalize "Ttk". Same thing happens.
So, I had to do:
use Tkx; my $mw = Tkx::widget->new('.'); #Main Window #buttons #used to be: #$mw->new_ttk__button(-text=>'button 1') #now: #$mw-> new_button(-text=>'button 1') my @btns = ( $mw->new_button(-text=>'button 1'), $mw->new_button(-text=>'button 2'), $mw->new_button(-text=>'button 3') ); #Place elements (buttons) in table grid #column x row coordinates $btns[0]->g_grid(-row=>0, -column=>0); $btns[1]->g_grid(-row=>0, -column=>1); $btns[2]->g_grid(-row=>1, -column=>1); #Event Loop Tkx::MainLoop();
And it works that way, but I figure that ttk is the package that allows for themed widgets, but when I use regular button, as I did in the last code above, it is a standard blocky widget.

Does anybody know how the person that made the example with ttk, managed it to work?

I have:
ActiveState perl, v5.10.0 built for MSWin32-x86-multi-thread

In reply to Tkx ttk problem by igoryonya

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



  • 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, details, 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, summary, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.