Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
At work I code by the ton. At home I could for fun; experimenting with Tk and whatever other cool modules I might happen to stumble upon; to learn new things and tinker around with that which is cool (which would be just about anything PERL)

This time it is about as simple as it gets. Poking around the world of CPAN I found the module Tk::Clock. In a nutshell, this Tk module generates a digital clock face, analog clock face or both. I decided to assemble the script so that it generated a "BIG classic analog clock". The module allows for manipulation of the colors of the hands and tick marks. In addition, in this particular script, I have played around restricting resizing of the Tk GUI (I read about it in one of the major Perl Books). Anyway enough said. The code is posted below.

As always, any feedback is greatly appreciated! Enjoy!

Learning Is What Makes Life Interesting... And PerlMonks Is A Great Part Of Learning!


#!/usr/bin/perl -w use Tk; use Tk::Clock; my $MW=MainWindow->new(); ### --- Prevents Main Window Resizing $MW->bind('<Configure>' => sub{ my $xe = $MW->XEvent; $MW->maxsize($xe->w, $xe->h); $MW->minsize($xe->w, $xe->h); }); $MW->title("My Analog Clock"); $clock = $MW->Clock(); $clock->config( useDigital => 0, useAnalog => 1, anaScale => 880, handColor => 'Green4', secsColor => 'Red2', tickColor => 'Black', ); $clock->pack(); MainLoop();

In reply to Perl/Tk - Tk::Clock by PERLscienceman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2022-05-19 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (72 votes). Check out past polls.

    Notices?