beretboy has asked for the wisdom of the Perl Monks concerning the following question:
The Tk::Gauge module generates all manner of gee-whiz analog graphs. Sadly, as far as I can tell, this is all it's doing at the moment. Repeated attemps to have it draw a needle on said graphs have failed. Having run several of the example scripts to no avail, I asked monks on the CB and bart confirmed my results.
What I've found is that if I try to graph my own needle, using Tk::Canvas (of which Tk::Gauge is a MegaWidget) methods, the line is drawn "behind" the Gauge. I expect this is what's happening to the lines the module draws as well.
So the question is, how do I bring lines I draw to the foreground, and is the Tk::Gauge module really broken?
Example code can be found in the link above, and below I will include my code that draws a line "behind" the gauge (based on the thermometer example).
"Sanity is the playground of the unimaginative" -Unknown
What I've found is that if I try to graph my own needle, using Tk::Canvas (of which Tk::Gauge is a MegaWidget) methods, the line is drawn "behind" the Gauge. I expect this is what's happening to the lines the module draws as well.
So the question is, how do I bring lines I draw to the foreground, and is the Tk::Gauge module really broken?
Example code can be found in the link above, and below I will include my code that draws a line "behind" the gauge (based on the thermometer example).
#!/usr/local/bin/perl -w use Tk; use Tk::Gauge; use strict; use warnings; my $mw = MainWindow->new; our($temperature); my $thermo = $mw->Gauge( -from => -20, -to => 40, -huboutline => 'red', -majorticklabelskip => [-20,40], -minortickinterval => 5, -finetickinterval => 1, -style => 'pieslice', -margin => 20, -bandwidth => 5, -bands => [ { -minimum => -20, -maximum => -5, -arccolor => '#aa00aa', }, { -minimum => -5, -maximum => 5, -arccolor => '#0000ff', }, { -minimum => 5, -maximum => 15, -arccolor => '#00ff00', }, { -minimum => 15, -maximum => 25, -arccolor => '#ffff00', }, { -minimum => 25, -maximum => 35, -arccolor => '#ff8800', }, { -minimum => 35, -maximum => 40, -arccolor => '#ff0000', }, ], -needles =>[ { -arrowshape => [0,0,0], -radius => 60, -variable => \$temperature, -color => 'black', -width => 2, -showvalue => 1, -format => '%.1f C', }, ], )->pack; $mw->after( 1000, sub{ $temperature = 18.2 } ); $thermo->createLine(0,0,200,200, -width => 5); # Line should go right +across gauge! MainLoop;
"Sanity is the playground of the unimaginative" -Unknown
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Tk::Gauge Module Borked?
by zentara (Archbishop) on Jul 06, 2005 at 16:59 UTC | |
Re: Tk::Gauge Module Borked?
by Anonymous Monk on Jul 06, 2005 at 17:52 UTC | |
Re: Tk::Gauge Module Borked?
by beretboy (Chaplain) on Jul 06, 2005 at 18:37 UTC | |
Re: Tk::Gauge Module Borked?
by beretboy (Chaplain) on Jul 06, 2005 at 17:12 UTC | |
Re: Tk::Gauge Module Borked?
by Anonymous Monk on Jul 06, 2005 at 17:40 UTC | |
Re: Tk::Gauge Module Borked?
by zentara (Archbishop) on Jul 09, 2005 at 15:17 UTC |
Back to
Seekers of Perl Wisdom