NAME

Tk::StrfClock - a X/TK digital clock widget based on strftime.

SYNOPSIS

  use Tk::StrfClock;

  $top->StrfClock(
	-type	=> [Label|Button|Menubutton|Optionmenu],
  	-format	=> <strftime format string>,
	-update => [<seconds>|s|m|h|d],
	-advance => [<seconds>],
	-action	=> <pattern matching action>,
	-ontick	=> <function>,
  );

DESCRIPTION

Tk::StrfClock is a string clock widget based on one of a Tk::Label, a Tk::Button, a Tk::Menubutton or a Tk::Optionmenu (chosen at creation time). The current date and time (in some chosen configuration) is displayed as the text in the base widget.

OPTIONS

All the base widget options are available.

-type => [Label|Button|Menubutton|Optionmenu],

Set the base widget type at creation time. This cannot be configured thereafter. The default is Tk::Label.

-format => <strftime format string>

Sets the required date/time format using POSIX strftime format. The default is %c.

-update => <seconds>|s|m|h|d|a

Sets how often the clock is updated. If set to the characters s, m, h, d or a then the clock is updated exactly on the second, minute, hour, day or is automatically guessed.

The default is a.

-advance => <seconds>

Sets the clock fast or slow this many seconds. The default is 0.

-action => <pattern matching action>

Sets a pattern matching action to be applied to the date string before it is displayed. The default is to do nothing.

-ontick => <function>

Set a function to be run every tick of the clock. The default is none.

MINIMAL EXAMPLE

use Tk;
use Tk::StrfClock;

my $top=MainWindow->new();
$top->StrfClock()->pack();
MainLoop();

TESTING

Run the module itself to start a test program. To increase the size of the fond add something like

    *StrfClock*font: -*-fixed-medium-r-normal--20-*-*-*-*-*-*-*

to your .Xdefaults file.

SEE ALSO

See Tk for Perl/Tk documentation.

AUTHOR

Anthony R Fletcher, <a r i f 'a-t' c p a n . o r g>

COPYRIGHT AND LICENSE

Copyright (C) 1998-2014 by Anthony R Fletcher. All rights reserved. Please retain my name on any bits taken from this code. This code is supplied as-is - use at your own risk.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16.3 or, at your option, any later version of Perl 5 you may have available.