My bad, I was using: Tkx::ttk__button()
whereas your code used: Tkx::button()
Sigh. BTW: I am writing my very 1st Tkinter code, so your help is greatly appreciated.
The latter surely supports "-background".
However, I still cannot get the color to change.
So, I reduced your example to 2 buttons, code at bottom.
One confusion is "what replaces the 'i' in: Tkx::i:..."
as noted in your "I FIGURED IT OUT" response:
Tkx::i::call(".b", "configure", "-background", "blue");
Your response says:
"You just have to change the letter [I presume ::i::] to match the button."
The other confusion: where is the syntax to spec what gets "call"'ed...
"Undefined subroutine &Tkx::button::call...:
Complete runtime error is below.
For ref, the following 2-command example works fine:
-command => sub { print "18L\n"; print "18L #2\n"; },
So I tried the following (yep, some desperation flailing...):
-command => sub { print "18L\n"; Tkx::.b::call(".b", "configure", "-background", "blue"); },
-command => sub { print "18L\n"; Tkx::button::call(".b", "configure", "-background", "blue"); },
-command => sub { print "18L\n"; Tkx::".b"::call(".b", "configure", "-background", "blue"); },
#3 = syntax error (obviously)
#1 and #2 = the following runtime (Application) error, after clicking the "18-Letters" button:
Undefined subroutine &Tkx::button::call called at H:\NotPhotos\Computer\Raspberry_Pi\Perl\test2.pl line 15.
Undefined subroutine &Tkx::button::call called at H:\NotPhotos\Computer\Raspberry_Pi\Perl\test2.pl line 15.
while executing
"::perl::CODE(0x4de7f0)"
invoked from within
".b invoke"
("uplevel" body line 1)
invoked from within
"uplevel #0 list $w invoke"
(procedure "tk::ButtonUp" line 24)
invoked from within
"tk::ButtonUp .b"
(command bound to event)
use strict;
use warnings;
use Tkx;
my $mw = Tkx::widget->new(".");
$mw->g_wm_title("Jobs Not Forecasted");
Tkx::button(".b",
-text => "18-Letters",
-background => "red",
-width => 11,
-command => sub { print "18L\n"; print "18L #2\n"; }, # OK
# -command => sub { print "18L\n"; Tkx::.b::call(".b", "configure", "
+-background", "blue"); }, # BAD, runtime error
# -command => sub { print "18L\n"; Tkx::button::call(".b", "configure
+", "-background", "blue"); },# BAD, runtime error
# -command => sub { print "18L\n"; Tkx::".b"::call(".b", "configure",
+ "-background", "blue"); }, # BAD, syntax error
);
Tkx::pack(".b");
Tkx::button(".s",
-text => "EXIT",
-width => 11,
-command => sub { Tkx::destroy("."); },
);
Tkx::pack(".s");
Tkx::MainLoop();
|