wx.lib.calendar.Calendar¶
A calendar control class.
 Class Hierarchy¶
 Known Superclasses¶
 Methods Summary¶
Default class constructor.  | 
|
Can it accept focus?  | 
|
Add a selection.  | 
|
Decrement the month by 1.  | 
|
Decrement the year by 1.  | 
|
Do the drawing.  | 
|
Draw the focus indicator or a border.  | 
|
Draw a rectangle.  | 
|
Draw a rectangle.  | 
|
Get a color.  | 
|
Get the set calendar date.  | 
|
Get the set calendar day.  | 
|
Find the clicked area rectangle.  | 
|
Get the set calendar month.  | 
|
Get the set calendar year.  | 
|
Hide the calendar grid.  | 
|
Hide the calendar title.  | 
|
Increment the month by 1.  | 
|
Increment the year by 1.  | 
|
Is the day in the weekend  | 
|
Move the current date by a given interval of months/years.  | 
|
Key down event handler.  | 
|
Kill focus event handler.  | 
|
Left double mouse click event handler.  | 
|
Left mouse click event handler.  | 
|
Middle double mouse click event handler.  | 
|
Middle mouse click event handler.  | 
|
The on paint event handler.  | 
|
Right double mouse click event handler.  | 
|
Right mouse click event handler.  | 
|
Set focus event handler.  | 
|
The on size event handler.  | 
|
Determine the calendar rectangle click area and draw a selection.  | 
|
Select the day.  | 
|
Set the calendar type to ‘BUS’.  | 
|
Set a color.  | 
|
Set the current day to today.  | 
|
Set a calendar date.  | 
|
Set the day.  | 
|
Set the day.  | 
|
Set the margins  | 
|
Set the Month.  | 
|
Set the current day.  | 
|
Set the days to highlight.  | 
|
Set the size.  | 
|
Set the text alignment.  | 
|
Set the week title color.  | 
|
Set the year.  | 
|
Highlight the weekend.  | 
|
Test to see if the selection has a date and create event.  | 
 Class API¶
- class Calendar(wx.Control)¶
 A calendar control class.
Methods¶
- __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.Size(200, 200), style=0, validator=wx.DefaultValidator, name='calendar')¶
 Default class constructor.
- Parameters:
 parent (wx.Window) – parent window. Must not be
None;id (integer) – window identifier. A value of -1 indicates a default value;
pos (tuple or
wx.Point) – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;size (tuple or
wx.Size) – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;style (integer) – the button style (unused);
validator (wx.Validator) – the validator associated to the button;
name (string) – the calendar name.
- AcceptsFocus(self)¶
 Can it accept focus?
- AddSelect(self, list, font_color, back_color)¶
 Add a selection.
- Parameters:
 list – list of days to select
font_color – the font color to use
back_color – the back color to use
- DecMonth(self)¶
 Decrement the month by 1.
- DecYear(self)¶
 Decrement the year by 1.
- DrawFocusIndicator(self, draw)¶
 Draw the focus indicator or a border.
- Parameters:
 draw –
Truedraws the focus indicator,Falsea border
- DrawRect(self, key, bgcolor='WHITE', fgcolor='PINK', width=0)¶
 Draw a rectangle.
- Parameters:
 key – the day to draw the rectangle on
bgcolor – the background color
- DrawRectOrg(self, key, fgcolor='BLACK', width=0)¶
 Draw a rectangle.
- Parameters:
 key – the day to draw the rectangle on
fgcolor – the color for the pen
width – the width for the pen
- GetColor(self, name)¶
 Get a color.
- Parameters:
 name – a valid color name, can be defined using
SetColor
- GetDate(self)¶
 Get the set calendar date.
- Returns:
 the day, the month and the year
- GetDay(self)¶
 Get the set calendar day.
- Returns:
 the day
- GetDayHit(self, mx, my)¶
 Find the clicked area rectangle.
- Parameters:
 mx – the x position
my – the y position
- GetMonth(self)¶
 Get the set calendar month.
- Returns:
 the month
- GetYear(self)¶
 Get the set calendar year.
- Returns:
 the year
- HideGrid(self)¶
 Hide the calendar grid.
- HideTitle(self)¶
 Hide the calendar title.
- IncMonth(self)¶
 Increment the month by 1.
- IncYear(self)¶
 Increment the year by 1.
- IsDayInWeekend(self, key)¶
 Is the day in the weekend
- Parameters:
 key – the day to check
- MoveDate(self, months=0, years=0)¶
 Move the current date by a given interval of months/years.
- Parameters:
 months (int) – months to add (can be negative)
years (int) – years to add (can be negative)
- Returns:
 the new date set.
- OnKeyDown(self, event)¶
 Key down event handler.
- OnKillFocus(self, event)¶
 Kill focus event handler.
- OnLeftDEvent(self, event)¶
 Left double mouse click event handler.
- OnLeftEvent(self, event)¶
 Left mouse click event handler.
- OnMiddleDEvent(self, event)¶
 Middle double mouse click event handler.
- OnMiddleEvent(self, event)¶
 Middle mouse click event handler.
- OnPaint(self, event)¶
 The on paint event handler.
- OnRightDEvent(self, event)¶
 Right double mouse click event handler.
- OnRightEvent(self, event)¶
 Right mouse click event handler.
- OnSetFocus(self, event)¶
 Set focus event handler.
- OnSize(self, evt)¶
 The on size event handler.
- ProcessClick(self, event)¶
 Determine the calendar rectangle click area and draw a selection.
- SelectDay(self, key)¶
 Select the day.
- Parameters:
 key – The day to select
- SetBusType(self)¶
 Set the calendar type to ‘BUS’.
- SetColor(self, name, value)¶
 Set a color.
- Parameters:
 name – the name to be assigned to the color.
value – the color value, see
wx.Colourfor valid values
- SetCurrentDay(self)¶
 Set the current day to today.
- SetDate(self, day, month, year)¶
 Set a calendar date.
- Parameters:
 day (int) – the day
month (int) – the month
year (int) – the year
- Raises:
 ValueError when setting an invalid month/year
- Returns:
 the new date set.
- SetDay(self, day)¶
 Set the day.
- Parameters:
 day – the day to select
- SetDayValue(self, day)¶
 Set the day.
- Parameters:
 day (int) – the day
- Raises:
 ValueError if the resulting date is invalid.
- SetMargin(self, xmarg, ymarg)¶
 Set the margins
- Parameters:
 xmarg – the ‘x’ margin
ymarg – the ‘y’ margin
- SetMonth(self, month)¶
 Set the Month.
- Parameters:
 month (int) – the month
- Raises:
 ValueError if the resulting date is invalid.
- SetNow(self)¶
 Set the current day.
- SetSelDay(self, sel)¶
 Set the days to highlight.
- Parameters:
 sel (list) – the list of days to highlight
- SetSize(self, set_size)¶
 Set the size.
- Parameters:
 set_size (tuple or
wx.Size) – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
- SetTextAlign(self, vert, horz)¶
 Set the text alignment.
- Parameters:
 vert – the vertical alignment
horz – the horizontal alignment
- SetWeekColor(self, font_color, week_color)¶
 Set the week title color.
- Parameters:
 font_color – the font color to use.
week_color – the week color to use for the background.
- SetYear(self, year)¶
 Set the year.
- Parameters:
 year (int) – the year
- Raises:
 ValueError if the resulting date is invalid.
- ShowWeekEnd(self)¶
 Highlight the weekend.
- TestDay(self, key)¶
 Test to see if the selection has a date and create event.
- Parameters:
 key – the day to test