Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Perl/Tk - Tk::Clock

by zentara (Archbishop)
on Jul 17, 2003 at 15:11 UTC ( #275241=note: print w/replies, xml ) Need Help??

in reply to Perl/Tk - Tk::Clock

Hi, yeah, I've adopted tk-clock along time ago for my clock. I have a very minimalist desktop, and all I wanted was a tiny digital clock in the lower right hand corner. It also stays on top across my 10 virtual desktops. I've shown how to cut off the date too. I have a 1024x768 desktop, so you may have to adjust the geometry for your desktop.
#!/usr/bin/perl use Tk; use Tk::Clock; my $m = MainWindow->new(); #$m -> geometry("70x30+930+740"); #with date $m -> geometry("70x15+940+755"); #no date $m->overrideredirect(1); #no xterm decorations my $c = $m->Clock (-background => "Black"); $c->config ( useAnalog => 0, useDigital => 1, # tickColor => "Orange", # handColor => "Red", # secsColor => "Green", timeColor => "lightBlue", # timeFormat => "hh:MM A", timeFormat => "HH:MM:SS", # dateColor => "Gold", # dateFormat => "m/d/y", timeFont => "-misc-fixed-medium-r-normal--13-*-75-75-c-*-iso8859- +1", ); $c->pack; MainLoop;

Replies are listed 'Best First'.
Re: Re: Perl/Tk - Tk::Clock
by PERLscienceman (Curate) on Jul 17, 2003 at 21:28 UTC
    Greetings! Thank you for your response. Since you mentioned small digital clocks based on Tk; here is another one, even simpler than the first. It is based on the Tk::StrfClock module. All of about 6 lines of code to get it going, it generates a small Tk Widget with date and time.

    Here is the code, very simple. Enjoy!

    #!/usr/bin/perl -w use Tk; use Tk::StrfClock; my $top=MainWindow->new(); $top->StrfClock()->pack(); MainLoop();
      Hey that last (short one) looks like a winner. However, I don't see it in the ActiveState list. Thats where I get my modules from for Win32 system.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://275241]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2022-05-18 10:14 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (70 votes). Check out past polls.