> >>> If I try something like:
> >>>     $g_widgets{EntryTheme} = 
> Tkx::ttk__style_configure("Red.TEntry",
> >>> -background =>  "red");
> >>> I get:
> >>>     invalid command name "ttk::style" at ...
> >>> I took the ttk__style_configure() from the tutorial at 
> >>> http://www.tkdocs.com/tutorial
> >>
> >> That works for me.  Are you still using the older Tkx?  Do 
> you have 
> >> the 'tile' package in use in that case?  I would recommend 
> using the 
> >> latest ActivePerl though to keep it most consistent with docs and 
> >> examples that will mostly be Tk 8.5 based.
> >>
> > I'm using Perl 5.8.8, with Tk 8.4.15.  Is there support for 
> specifying 
> > and using a different style in 8.4.15?
> 
> Try just using the 'style' command.  I believe that version 
> may preceed 'style' being placed in the ttk namespace.  The 
> docs for tile's style are at
>       http://tktable.sourceforge.net/tile/doc/style.html
> and if you look at the 2004 PDF referenced, I see that style 
> was not namespaced at the time.
> 
> Jeff
> 
Again, I'm not very good at converting from tcl to Perl.  Is there an
example of changing the style of an entry?  Here's what I have so far,
and it will change the button, but not the entry widgets:

use strict;
use Tkx;
Tkx::package_require("tile");
Tkx::package_require("style");

my $mw = Tkx::widget->new(".");

my $text1 = "hello world";
my $text2 = "2nd entry widget";

my $entry1 = $mw->new_ttk__entry(-width => 20, -textvariable =>
\$text1);
$entry1->configure(-font => "helvetica 24 bold");
$entry1->g_grid(-column => 0, -row => 0, -sticky => 'w');

my $entry2 = $mw->new_ttk__entry(-width => 20, -textvariable => \$text2,
-style => "Dss.TEntry");
$entry2->configure(-font => "helvetica 24 bold");
$entry2->g_grid(-column => 0, -row => 1, -sticky => 'w');

my $button = $mw->new_ttk__button(-text => "Push Me");
$button->g_grid(-column => 0, -row => 2);

print "style_theme_names: " . Tkx::style_theme_names() . "\n";
#print "current theme: " . Tkx::current_theme() . "\n";
print "style_layout for TButton: " . Tkx::style_layout('TButton') .
"\n";
print "style_layout for TEntry: " . Tkx::style_layout('TEntry') . "\n";
#print "style_layout for entry2: " . Tkx::style_layout($entry2) . "\n";
Tkx::style_theme_use("alt");
print "style_lookup for TButton, -font: " . Tkx::style_lookup('TButton',
'-font') . "\n";
#print "style_element_options for Button.label: " .
Tkx::style_element_options('Button.label') . "\n";
print "button text: " . $button->cget(-text) . "\n";
print "get info about text option: " . $button->configure(-text) . "\n";
#print "splitlist: " . Tkx::SplitList($button->configure(-text)) . "\n";
#print "get info on all options: " . $b->configure . "\n";
Tkx::style_configure("TButton", -font => "helvetica 24");
Tkx::style_configure("TEntry", -background => "red", -font => "Courier
10");
#Tkx::style_configure("TEntry", -font => "courier 10");
#$entry2->configure(-style => "Red.TEntry");
Tkx::style_configure("Dss.TEntry", -background => "red", -font =>
"Courier 10");

Tkx::after(3000, sub { AfterDelay(); });

Tkx::MainLoop();


sub AfterDelay
{
    Tkx::style_configure("TButton", -font => "courier 10");
    Tkx::style_configure("TEntry", -font => "courier 10");
    $button->configure(-text => "Hello");
    $text2 = "in AfterDelay";
    Tkx::after(3000, sub { AfterDelay2(); });
}

sub AfterDelay2
{
    $text2 = "in AfterDelay2";
    Tkx::style_map("TEntry",
                    -background => ["disabled" => "red", "active" =>
"blue"],
                    -foreground => ["disabled" => "yellow", "active" =>
"green"]);
}

Reply via email to