Home | Trees | Index | Help |
|
---|
Package wx :: Module calendar :: Class CalendarCtrl |
|
object
--+ |Object
--+ |EvtHandler
--+ |Window
--+ |Control
--+ | CalendarCtrl
The calendar control allows the user to pick a date interactively.
The CalendarCtrl displays a window containing several parts: the control to pick the month and the year at the top (either or both of them may be disabled) and a month area below them which shows all the days in the month. The user can move the current selection using the keyboard and select the date (generating EVT_CALENDAR event) by pressing <Return> or double clicking it.
It has advanced possibilities for the customization of its display. All global settings (such as colours and fonts used) can, of course, be changed. But also, the display style for each day in the month can be set independently using CalendarDateAttr class.
An item without custom attributes is drawn with the default colours
and font and without border, but setting custom attributes with
SetAttr
allows to modify its appearance. Just create a custom
attribute object and set it for the day you want to be displayed
specially A day may be marked as being a holiday, (even if it is not
recognized as one by wx.DateTime
) by using the SetHoliday method.
As the attributes are specified for each day, they may change when the month is changed, so you will often want to update them in an EVT_CALENDAR_MONTH event handler.
CAL_SUNDAY_FIRST Show Sunday as the first day in the week CAL_MONDAY_FIRST Show Monday as the first day in the week CAL_SHOW_HOLIDAYS Highlight holidays in the calendar CAL_NO_YEAR_CHANGE Disable the year changing CAL_NO_MONTH_CHANGE Disable the month (and, implicitly, the year) changing CAL_SHOW_SURROUNDING_WEEKS Show the neighbouring weeks in the previous and next months CAL_SEQUENTIAL_MONTH_SELECTION Use alternative, more compact, style for the month and year selection controls.
The default calendar style is CAL_SHOW_HOLIDAYS.
EVT_CALENDAR A day was double clicked in the calendar. EVT_CALENDAR_SEL_CHANGED The selected date changed. EVT_CALENDAR_DAY The selected day changed. EVT_CALENDAR_MONTH The selected month changed. EVT_CALENDAR_YEAR The selected year changed. EVT_CALENDAR_WEEKDAY_CLICKED User clicked on the week day header
Note that changing the selected date will result in one of EVT_CALENDAR_DAY, MONTH or YEAR events and an EVT_CALENDAR_SEL_CHANGED event.
Method Summary | |
---|---|
CalendarCtrl |
Create and show a calendar control. |
bool |
Acutally create the GUI portion of the CalendarCtrl for 2-phase creation. |
This function should be used instead of changing CAL_SHOW_HOLIDAYS style bit directly. | |
This function should be used instead of changing CAL_NO_MONTH_CHANGE style bit. | |
This function should be used instead of changing CAL_NO_YEAR_CHANGE style bit directly. | |
CalendarDateAttr |
Returns the attribute for the given date (should be in the range 1...31). |
VisualAttributes |
Get the default attributes for this class. (Static method) |
DateTime |
Gets the currently selected date. |
Colour |
Header colours are used for painting the weekdays at the top. |
Colour |
Header colours are used for painting the weekdays at the top. |
Colour |
Highlight colour is used for the currently selected date. |
Colour |
Highlight colour is used for the currently selected date. |
Colour |
Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is used). |
Colour |
Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is used). |
DateTime |
get the range in which selection can occur |
Control |
Get the currently shown control for month. |
DateTime |
get the range in which selection can occur |
Control |
Get the currently shown control for year. |
(result, date, weekday) |
Returns 3-tuple with information about the given position on the calendar control. |
returns datetime.date object | |
returns datetime.date object | |
returns datetime.date object | |
takes datetime.datetime or datetime.date object | |
takes datetime.datetime or datetime.date objects | |
takes datetime.datetime or datetime.date object | |
takes datetime.datetime or datetime.date object | |
Clears any attributes associated with the given day (in the range 1...31). | |
Associates the attribute with the specified date (in the range 1...31). | |
Sets the current date. | |
bool |
set the range in which selection can occur |
Header colours are used for painting the weekdays at the top. | |
Highlight colour is used for the currently selected date. | |
Marks the specified day as being a holiday in the current month. | |
Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is used). | |
bool |
set the range in which selection can occur |
bool |
set the range in which selection can occur |
Property Summary | |
---|---|
Date : See GetDate and SetDate | |
HeaderColourBg : See GetHeaderColourBg | |
HeaderColourFg : See GetHeaderColourFg | |
HighlightColourBg : See GetHighlightColourBg | |
HighlightColourFg : See GetHighlightColourFg | |
HolidayColourBg : See GetHolidayColourBg | |
HolidayColourFg : See GetHolidayColourFg | |
LowerDateLimit : See GetLowerDateLimit and SetLowerDateLimit | |
MonthControl : See GetMonthControl | |
thisown : The membership flag | |
UpperDateLimit : See GetUpperDateLimit and SetUpperDateLimit | |
YearControl : See GetYearControl |
Instance Method Details |
---|
__init__(self,
parent,
id=-1,
date=DefaultDateTime,
pos=DefaultPosition,
size=DefaultSize,
style=wxCAL_SHOW_HOLIDAYS|wxWANTS_CHARS,
name=CalendarNameStr)
|
Create(self, parent, id, date=DefaultDateTime, pos=DefaultPosition, size=DefaultSize, style=wxCAL_SHOW_HOLIDAYS|wxWANTS_CHARS, name=CalendarNameStr)Acutally create the GUI portion of the CalendarCtrl for 2-phase creation.
|
EnableHolidayDisplay(self, display=True)This function should be used instead of changing CAL_SHOW_HOLIDAYS style bit directly. It enables or disables the special highlighting of the holidays.
|
EnableMonthChange(self, enable=True)This function should be used instead of changing CAL_NO_MONTH_CHANGE style bit. It allows or disallows the user to change the month interactively. Note that if the month can not be changed, the year can not be changed either.
|
EnableYearChange(self, enable=True)This function should be used instead of changing CAL_NO_YEAR_CHANGE style bit directly. It allows or disallows the user to change the year interactively.
|
GetAttr(self, day)Returns the attribute for the given date (should be in the range 1...31). The returned value may be None
|
GetDate(self)Gets the currently selected date.
|
GetHeaderColourBg(self)Header colours are used for painting the weekdays at the top.
|
GetHeaderColourFg(self)Header colours are used for painting the weekdays at the top.
|
GetHighlightColourBg(self)Highlight colour is used for the currently selected date.
|
GetHighlightColourFg(self)Highlight colour is used for the currently selected date.
|
GetHolidayColourBg(self)Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is used).
|
GetHolidayColourFg(self)Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is used).
|
GetLowerDateLimit(self)get the range in which selection can occur
|
GetMonthControl(self)Get the currently shown control for month.
|
GetUpperDateLimit(self)get the range in which selection can occur
|
GetYearControl(self)Get the currently shown control for year.
|
HitTest(pos)Returns 3-tuple with information about the given position on the calendar control. The first value of the tuple is a result code and determines the validity of the remaining two values. The result codes are:
|
PyGetDate(self)returns datetime.date object |
PyGetLowerDateLimit(self)returns datetime.date object |
PyGetUpperDateLimit(self)returns datetime.date object |
PySetDate(self, date)takes datetime.datetime or datetime.date object |
PySetDateRange(self, lowerdate, upperdate)takes datetime.datetime or datetime.date objects |
PySetLowerDateLimit(self, date)takes datetime.datetime or datetime.date object |
PySetUpperDateLimit(self, date)takes datetime.datetime or datetime.date object |
ResetAttr(self, day)Clears any attributes associated with the given day (in the range 1...31).
|
SetAttr(self, day, attr)Associates the attribute with the specified date (in the range 1...31). If the attribute passed is None, the items attribute is cleared.
|
SetDate(self, date)Sets the current date.
|
SetDateRange(self, lowerdate=DefaultDateTime, upperdate=DefaultDateTime)set the range in which selection can occur
|
SetHeaderColours(self, colFg, colBg)Header colours are used for painting the weekdays at the top.
|
SetHighlightColours(self, colFg, colBg)Highlight colour is used for the currently selected date.
|
SetHoliday(self, day)Marks the specified day as being a holiday in the current month.
|
SetHolidayColours(self, colFg, colBg)Holiday colour is used for the holidays (if CAL_SHOW_HOLIDAYS style is used).
|
SetLowerDateLimit(self, date=DefaultDateTime)set the range in which selection can occur
|
SetUpperDateLimit(self, date=DefaultDateTime)set the range in which selection can occur
|
Static Method Details |
---|
GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)Get the default attributes for this class. This is useful if you want to use the same font or colour in your own control as in a standard control -- which is a much better idea than hard coding specific colours or fonts which might look completely out of place on the user's system, especially if it uses themes. The variant parameter is only relevant under Mac currently and is
ignore under other platforms. Under Mac, it will change the size of
the returned font. See
|
Property Details |
---|
Date |
HeaderColourBg
|
HeaderColourFg
|
HighlightColourBg
|
HighlightColourFg
|
HolidayColourBg
|
HolidayColourFg
|
LowerDateLimitSee
|
MonthControlSee
|
thisownThe membership flag
|
UpperDateLimitSee
|
YearControlSee
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:14:09 2007 | http://epydoc.sf.net |