Updated 22 Oct 2005

Brother t0mas -- Thanks so much for adding the button bevel size change to ButtonFactory. What was once good is even better!

In the interest of sharing, just for fun, I am posting some code I quickly hacked up last night to do something a little different with ButtonFactory from the command line. Based on what you include as a sample command-line script in the POD, here is what I am doing:

#!perl -w ## ------------------------------------------------------------ # MS Windoze-specific script. Sorry :-). ## ------------------------------------------------------------ # NOT like t0mas' original idea -- this makes buttons for # horizontal row use only bec if button text is longer # than 20 chars, it expands the length by 8 px for each one # (based on 8pt Myriad font). use ButtonFactory; use Win32::Clipboard; my ( $N_state $P_state @RGBt $BWi ); my $clipping; my $name_it = shift @ARGV; my $btnText = shift @ARGV; my $expsn = ((length ($btnText) - 20) > 0)? (length ($btnText) - 20) * 8 : 0 ; $BWi = 90 + $expsn; @RGBt = ($clipping=Win32::Clipboard::Get()) # Pick-'o-Color format for rgb triplet: "RGB(155, 50, 23)" ? grep /\d+/, (split /[^\d]/,$clipping) : split(/[^\w]/, shift @ARGV); if (scalar @RGBt == 3) { print "Using ", join( ', ',@RGBt ), " for color specification for b +uttons\n"; } else { die "No color as RGB triplet gotten! \nContents of \@RGBt if any: " ." $clipping ". "@RGBt"; } my $x=new ButtonFactory($BWi,21, $RGBt[0],$RGBt[1],$RGBt[2], $btnText =>"Myriad Web Bold.ttf"=>8); $N_state = $name_it .'N_state.png'; $P_state = $name_it .'P_state.png'; open (FILE,">$N_state") or die $!; binmode FILE; my $Ntime = time; print FILE $x->printNormal(); close (FILE); open (FILE,">$P_state") or die $!; binmode FILE; print FILE $x->printPressed(); close (FILE); utime $Ntime, $Ntime, ($N_state, $P_state); _END_

Pick'o'Color is  (was) a  Windows app found at:
http://www.itsme.de/software/index.html



 Best,
   soren      Intrepid

In reply to RE: ButtonFactory by Intrepid
in thread ButtonFactory by t0mas

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.