Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Perl / Tk Calendar - advice please.

by liverpole (Monsignor)
on Mar 13, 2007 at 18:37 UTC ( #604647=note: print w/replies, xml ) Need Help??


in reply to Perl / Tk Calendar - advice please.

Hi jdtoronto,

Have you considered using Tk::Month?

There's a simple example of how to use it here.

Even if you decide to go a similar (or different) route, I'd recommend trying it out, as it might give you some good ideas.

You will probably want to play around with printformat, though.  The value used in the node I referred to above doesn't send the day of the month to the anonymous subroutine.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Replies are listed 'Best First'.
Re^2: Perl / Tk Calendar - advice please.
by jdtoronto (Prior) on Mar 14, 2007 at 02:43 UTC
    Thanks liverpole,

    I had seen that only a few minutes before I posted. Interestingly it adopts the method I was proposing - using a button for each element. But it does work and I think a modified version of it will have a place in my application. I have played with some ideas for using a similar approach to my "week at a view" page and I think I can make it look respectable.

    jdtoronto

Re^2: Perl / Tk Calendar - advice please.
by Anonymous Monk on Apr 01, 2012 at 04:44 UTC
    Hi, How we get subroutine working, e.g. accept values for %a and %e when we press calendar button Insted anonymous subroutine I was using named subrutine, but not working Could someone help?
      The %e and %a are just formatting strings. Read perldoc Tk::Month to see how to change it. To get rid of the anonymous sub, it's simple, try this. I showed how to see what is passed to the sub. If this dosn't answer your question, be more specific in what you need to do.
      #!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Month; my $mw = MainWindow->new(); my $month = "November"; my $year = "2006"; my $m = $mw->Month( -printformat => '%a %e', -includeall => 0, -month => $month, -year => $year, -command => \&mysub ); $m->pack; MainLoop; sub mysub { print scalar @_,"\n"; print $_[0],"\n"; print $_[1],"\n"; print @{$_[1]},"\n"; my ($ym, $wd) = @_; my ($month, $year) = split( /\s+/ , $ym ); my ($wday, $date) = split( /\s+/ , $wd->[0] ); print "$wday, $month $date $year\n"; }

      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://604647]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2018-07-19 19:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (416 votes). Check out past polls.

    Notices?