I'm trying to learn Perl via the Learning Perl/Tk book published by O"Reilly.
There's a nifty little color changer program on page 95, this
is where I started. The program has evolved some and mostly works
however I have a problem that has hounded me for too long.
Changing the background color is okay using fixed names such
as purple3. Here's the problem: When I invoke the following:
$rb_value = "purple3"
($red, $green, $blue) = $widget->rgb($rb_value);
I expect to get three decimal numbers between 0 and 255 as
stated on page 293. What I get are three numbers much larger
than anticipated. for purple3, I get 32125, 9766, 52685.
WHY? I'd like to use the results to reset some rgb sliders
I use to display specific colors. HELP. I tried dividing
the large numbers by 256 and that gets me close and even
correct once in a while, but it isn't the right solution.
Sorry for the lengthy dialog.
2001-03-27 Edit by Corion : Added CODE tags. And it's a monolog(ue), not a dialog(ue).
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.