#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::ChooseDate; my ( $new_date ) = get_date(); print "ndt is '$new_date'\n"; sub get_date { #sets date thru the textvariable #my $date = '2006/6/6'; my $date = '4/1/2007'; #2006/6/6'; my $mw = new MainWindow; $mw->geometry('200x50'); $mw->fontCreate( 'big', -family=>'courier', -weight=>'bold', -size=>int(-18*18/14) ); my $cd = $mw->ChooseDate( -language =>'English', # changed from 'Italian' -font =>'big', # the label font -bg=>'lightsteelblue', #the label bg -textvariable=>\$date, -arrowcolor => 'black', -arrowactivecolor=>'yellow', -datecolor=> 'blue', -dateformat => 1, -orthodox => 1, # changed from '0' -daysofweekcolor=>'lightgreen', -highlightcolor=> 'pink', -linecolor=> 'green', -yearcolor=> 'black', #-command=>sub{print "$date\n"}, # quiesced this.... )->pack(-fill=>'x', -expand=>1); my $cdcan = $cd->Subwidget('canvas'); $cdcan->configure(-bg=>'black'); # bg of weekdays bar my $cdtop = $cd->Subwidget('toplevel'); $cdtop->configure(-bg=>'black'); # outline of popup # sets the date thru set $cd->set( y=>2005, m=>5, d=>5 ); my $get_button = $mw->Button( -text=>'Get', -command=>[\&ff_get, $date, $cd ], )->pack(); MainLoop; return ( $date ); } sub ff_get { my ( $date, $cd_or ) = @_; # $cd_or is an object reference print "getting....\n"; print "$date\n\n"; #print "$_[0]\n\n"; print "getting1....\n"; print $cd_or->get,"\n\n"; #print $_[1]->get,"\n\n"; }