This just is just a useful little utility to find the day/date/week number etc. for any date. It is all included in the Gtk2::Calendar widget. It scrolls thru months, and years. I havn't tested it's limits, but it goes ahead many centuries, and will go to B.C. as negative years. Handy for archeologists. :-)
#!/usr/bin/perl use warnings; use strict; use Gtk2 -init; #if you want to adjust colors, otherwise comment out Gtk2::Rc->parse_string(<<__); style "calendar" { bg[NORMAL] = "#aadddd" #background of header bar bg[SELECTED] = "#ff0000" #color of weekday bg when window is moved bg[PRELIGHT] = "#ccffff" #color of bg of selector-scroller triangles f +or month/year fg[NORMAL] = "#000000" #text for days(active) and header fg[PRELIGHT] = "#ff0000" #color of fg of selector-scroller triangles f +or month/year # For the selected item base[NORMAL] = "#ffffff" #background of dates display base[SELECTED] = "#99aaaa" #background of weekday names and days base[ACTIVE] = "#999999" #selected color when active base[PRELIGHT] = "#0000ff" #selected color when active }class "*Calendar*" style "calendar" __ ############################################################## #adjust font my $font = Gtk2::Pango::FontDescription->from_string("Sans Bold 24"); my $window = Gtk2::Window -> new("toplevel"); $window -> set_title ("Simple Calendar"); $window -> signal_connect (delete_event => sub { Gtk2 -> main_quit(); +}); my $calendar = Gtk2::Calendar -> new(); $calendar->signal_connect( 'day_selected_double_click' => sub { my ($year, $month, $day) = $calendar->get_date; printf("%02d/%d/%d\n", $month+1, $day, $year); }); #will show headings and day names by default, but must #declare them manually if adding week numbers $calendar->set_display_options(['show-week-numbers','show-heading','sh +ow-day-names'] ); $calendar->modify_font($font); $window -> add($calendar); $window -> show_all(); Gtk2 -> main();

In reply to Gtk2 Simple Calendar/ Date Selector by zentara

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.