phoenix_title wx.lib.calendar.Calendar

A calendar control class.


class_hierarchy Class Hierarchy

Inheritance diagram for class Calendar:

super_classes Known Superclasses

wx.Control


method_summary Methods Summary

__init__

Default class constructor.

AcceptsFocus

Can it accept focus?

AddSelect

Add a selection.

DecMonth

Decrement the month by 1.

DecYear

Decrement the year by 1.

DoDrawing

Do the drawing.

DrawFocusIndicator

Draw the focus indicator or a border.

DrawRect

Draw a rectangle.

DrawRectOrg

Draw a rectangle.

GetColor

Get a color.

GetDate

Get the set calendar date.

GetDay

Get the set calendar day.

GetDayHit

Find the clicked area rectangle.

GetMonth

Get the set calendar month.

GetYear

Get the set calendar year.

HideGrid

Hide the calendar grid.

HideTitle

Hide the calendar title.

IncMonth

Increment the month by 1.

IncYear

Increment the year by 1.

IsDayInWeekend

Is the day in the weekend

MoveDate

Move the current date by a given interval of months/years.

OnKeyDown

Key down event handler.

OnKillFocus

Kill focus event handler.

OnLeftDEvent

Left double mouse click event handler.

OnLeftEvent

Left mouse click event handler.

OnMiddleDEvent

Middle double mouse click event handler.

OnMiddleEvent

Middle mouse click event handler.

OnPaint

The on paint event handler.

OnRightDEvent

Right double mouse click event handler.

OnRightEvent

Right mouse click event handler.

OnSetFocus

Set focus event handler.

OnSize

The on size event handler.

ProcessClick

Determine the calendar rectangle click area and draw a selection.

SelectDay

Select the day.

SetBusType

Set the calendar type to ‘BUS’.

SetColor

Set a color.

SetCurrentDay

Set the current day to today.

SetDate

Set a calendar date.

SetDay

Set the day.

SetDayValue

Set the day.

SetMargin

Set the margins

SetMonth

Set the Month.

SetNow

Set the current day.

SetSelDay

Set the days to highlight.

SetSize

Set the size.

SetTextAlign

Set the text alignment.

SetWeekColor

Set the week title color.

SetYear

Set the year.

ShowWeekEnd

Highlight the weekend.

TestDay

Test to see if the selection has a date and create event.


api 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.



DoDrawing(self, DC)

Do the drawing.

Parameters:

DC – the wx.DC to draw



DrawFocusIndicator(self, draw)

Draw the focus indicator or a border.

Parameters:

drawTrue draws the focus indicator, False a 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.Colour for 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