Popup Calendar

from System.Windows.Forms import Form, MonthCalendar

#create a calendar
calendar = MonthCalendar()

#define what to do with the selected date
def onPickDate(sender,eventArgs):
selectedDate = calendar.SelectionRange.Start.ToShortDateString()
print selectedDate
Document.Properties["selectedDate"] = selectedDate

calendar.DateSelected += onPickDate

#put calendar in a form and show it
form = Form()
form.Text = "Select a date and close the form when done"
form.Controls.Add(calendar)
form.ShowDialog()
Previous
Next Post »