.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.calendar

.. highlight:: python



.. _wx.lib.calendar.Calendar:

==========================================================================================================================================
|phoenix_title|  **wx.lib.calendar.Calendar**
==========================================================================================================================================

A calendar control class.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>Calendar</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.calendar.Calendar_inheritance.png" alt="Inheritance diagram of Calendar" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="5,5,107,35"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="57,83,168,112"/> <area shape="rect" id="node2" href="wx.Control.html" title="wx.Control" alt="" coords="69,315,157,344"/> <area shape="rect" id="node6" href="wx.lib.calendar.Calendar.html" title="wx.lib.calendar.Calendar" alt="" coords="26,392,200,421"/> <area shape="rect" id="node3" href="wx.Window.html" title="wx.Window" alt="" coords="69,237,157,267"/> <area shape="rect" id="node4" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="53,160,173,189"/> <area shape="rect" id="node7" href="wx.Object.html" title="wx.Object" alt="" coords="131,5,212,35"/> </map> 
   </p>

|


|super_classes| Known Superclasses
==================================

:class:`wx.Control`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.calendar.Calendar.__init__`                                       Default class constructor.
:meth:`~wx.lib.calendar.Calendar.AcceptsFocus`                                   Can it accept focus?
:meth:`~wx.lib.calendar.Calendar.AddSelect`                                      Add a selection.
:meth:`~wx.lib.calendar.Calendar.DecMonth`                                       Decrement the month by 1.
:meth:`~wx.lib.calendar.Calendar.DecYear`                                        Decrement the year by 1.
:meth:`~wx.lib.calendar.Calendar.DoDrawing`                                      Do the drawing.
:meth:`~wx.lib.calendar.Calendar.DrawFocusIndicator`                             Draw the focus indicator or a border.
:meth:`~wx.lib.calendar.Calendar.DrawRect`                                       Draw a rectangle.
:meth:`~wx.lib.calendar.Calendar.DrawRectOrg`                                    Draw a rectangle.
:meth:`~wx.lib.calendar.Calendar.GetColor`                                       Get a color.
:meth:`~wx.lib.calendar.Calendar.GetDate`                                        Get the set calendar date.
:meth:`~wx.lib.calendar.Calendar.GetDay`                                         Get the set calendar day.
:meth:`~wx.lib.calendar.Calendar.GetDayHit`                                      Find the clicked area rectangle.
:meth:`~wx.lib.calendar.Calendar.GetMonth`                                       Get the set calendar month.
:meth:`~wx.lib.calendar.Calendar.GetYear`                                        Get the set calendar year.
:meth:`~wx.lib.calendar.Calendar.HideGrid`                                       Hide the calendar grid.
:meth:`~wx.lib.calendar.Calendar.HideTitle`                                      Hide the calendar title.
:meth:`~wx.lib.calendar.Calendar.IncMonth`                                       Increment the month by 1.
:meth:`~wx.lib.calendar.Calendar.IncYear`                                        Increment the year by 1.
:meth:`~wx.lib.calendar.Calendar.IsDayInWeekend`                                 Is the day in the weekend
:meth:`~wx.lib.calendar.Calendar.OnKeyDown`                                      Key down event handler.
:meth:`~wx.lib.calendar.Calendar.OnKillFocus`                                    Kill focus event handler.
:meth:`~wx.lib.calendar.Calendar.OnLeftDEvent`                                   Left double mouse click event handler.
:meth:`~wx.lib.calendar.Calendar.OnLeftEvent`                                    Left mouse click event handler.
:meth:`~wx.lib.calendar.Calendar.OnMiddleDEvent`                                 Middle double mouse click event handler.
:meth:`~wx.lib.calendar.Calendar.OnMiddleEvent`                                  Middle mouse click event  handler.
:meth:`~wx.lib.calendar.Calendar.OnPaint`                                        The on paint event handler.
:meth:`~wx.lib.calendar.Calendar.OnRightDEvent`                                  Right double mouse click event handler.
:meth:`~wx.lib.calendar.Calendar.OnRightEvent`                                   Right mouse click event handler.
:meth:`~wx.lib.calendar.Calendar.OnSetFocus`                                     Set focus event handler.
:meth:`~wx.lib.calendar.Calendar.OnSize`                                         The on size event handler.
:meth:`~wx.lib.calendar.Calendar.ProcessClick`                                   Determine the calendar rectangle click area and draw a selection.
:meth:`~wx.lib.calendar.Calendar.SelectDay`                                      Select the day.
:meth:`~wx.lib.calendar.Calendar.SetBusType`                                     Set the calendar type to 'BUS'.
:meth:`~wx.lib.calendar.Calendar.SetColor`                                       Set a color.
:meth:`~wx.lib.calendar.Calendar.SetCurrentDay`                                  Set the current day to today.
:meth:`~wx.lib.calendar.Calendar.SetDay`                                         Set the day.
:meth:`~wx.lib.calendar.Calendar.SetDayValue`                                    Set the day.
:meth:`~wx.lib.calendar.Calendar.SetMargin`                                      Set the margins
:meth:`~wx.lib.calendar.Calendar.SetMonth`                                       Set the Month.
:meth:`~wx.lib.calendar.Calendar.SetNow`                                         Get the current day.
:meth:`~wx.lib.calendar.Calendar.SetSelDay`                                      Set the days to highlight.
:meth:`~wx.lib.calendar.Calendar.SetSize`                                        Set the size.
:meth:`~wx.lib.calendar.Calendar.SetTextAlign`                                   Set the text allignment.
:meth:`~wx.lib.calendar.Calendar.SetWeekColor`                                   Set the week title color.
:meth:`~wx.lib.calendar.Calendar.SetYear`                                        Set the year.
:meth:`~wx.lib.calendar.Calendar.ShowWeekEnd`                                    Highlight the weekend.
:meth:`~wx.lib.calendar.Calendar.TestDay`                                        Test to see if the selection has a date and create event.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: Calendar(wx.Control)

   A calendar control class.

   .. method:: __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.Size(200, 200), style=0, validator=wx.DefaultValidator, name="calendar")

      Default class constructor.
      
      :param wx.Window `parent`: parent window. Must not be ``None``;
      :param integer `id`: window identifier. A value of -1 indicates a default value;
      :param `pos`: the control position. A value of (-1, -1) indicates a default position,
       chosen by either the windowing system or wxPython, depending on platform;
      :type `pos`: tuple or :class:`wx.Point`
      :param `size`: the control size. A value of (-1, -1) indicates a default size,
       chosen by either the windowing system or wxPython, depending on platform;
      :type `size`: tuple or :class:`wx.Size`
      :param integer `style`: the button style (unused);
      :param wx.Validator `validator`: the validator associated to the button;
      :param string `name`: the calendar name.


   .. method:: AcceptsFocus(self)

      Can it accept focus?


   .. method:: AddSelect(self, list, font_color, back_color)

      Add a selection.
      
      :param `list`: list of days to select
      :param `font_color`: the font color to use
      :param `back_color`: the back color to use


   .. method:: DecMonth(self)

      Decrement the month by 1.


   .. method:: DecYear(self)

      Decrement the year by 1.


   .. method:: DoDrawing(self, DC)

      Do the drawing.
      
      :param `DC`: the :class:`wx.DC` to draw


   .. method:: DrawFocusIndicator(self, draw)

      Draw the focus indicator or a border.
      
      :param `draw`: ``True`` draws the focus indicator, ``False`` a border


   .. method:: DrawRect(self, key, bgcolor='WHITE', fgcolor='PINK', width=0)

      Draw a rectangle.
      
      :param `key`: the day to draw the rectangle on
      :param `bgcolor`: the background color


   .. method:: DrawRectOrg(self, key, fgcolor='BLACK', width=0)

      Draw a rectangle.
      
      :param `key`: the day to draw the rectangle on
      :param `fgcolor`: the color for the pen
      :param `width`: the width for the pen


   .. method:: GetColor(self, name)

      Get a color.
      
      :param `name`: a valid color name, can be defined using :meth:`SetColor`


   .. method:: GetDate(self)

      Get the set calendar date.
      
      :returns: the day, the month and the year


   .. method:: GetDay(self)

      Get the set calendar day.
      
      :returns: the day


   .. method:: GetDayHit(self, mx, my)

      Find the clicked area rectangle.
      
      :param `mx`: the x position
      :param `my`: the y positon


   .. method:: GetMonth(self)

      Get the set calendar month.
      
      :returns: the month


   .. method:: GetYear(self)

      Get the set calendar year.
      
      :returns: the year


   .. method:: HideGrid(self)

      Hide the calendar grid.


   .. method:: HideTitle(self)

      Hide the calendar title.


   .. method:: IncMonth(self)

      Increment the month by 1.


   .. method:: IncYear(self)

      Increment the year by 1.


   .. method:: IsDayInWeekend(self, key)

      Is the day in the weekend
      
      :param `key`: the day to check


   .. method:: OnKeyDown(self, event)

      Key down event handler.


   .. method:: OnKillFocus(self, event)

      Kill focus event handler.


   .. method:: OnLeftDEvent(self, event)

      Left double mouse click event handler.


   .. method:: OnLeftEvent(self, event)

      Left mouse click event handler.


   .. method:: OnMiddleDEvent(self, event)

      Middle double mouse click event handler.


   .. method:: OnMiddleEvent(self, event)

      Middle mouse click event  handler.


   .. method:: OnPaint(self, event)

      The on paint event handler.


   .. method:: OnRightDEvent(self, event)

      Right double mouse click event handler.


   .. method:: OnRightEvent(self, event)

      Right mouse click event handler.


   .. method:: OnSetFocus(self, event)

      Set focus event handler.


   .. method:: OnSize(self, evt)

      The on size event handler.


   .. method:: ProcessClick(self, event)

      Determine the calendar rectangle click area and draw a selection.


   .. method:: SelectDay(self, key)

      Select the day.
      
      :param `key`: The day to select


   .. method:: SetBusType(self)

      Set the calendar type to 'BUS'.


   .. method:: SetColor(self, name, value)

      Set a color.
      
      :param `name`: the name to be assigned to the color.
      :param `value`: the color value, see :class:`wx.Colour` for valid values


   .. method:: SetCurrentDay(self)

      Set the current day to today.


   .. method:: SetDay(self, day)

      Set the day.
      
      :param `day`: the day to select


   .. method:: SetDayValue(self, day)

      Set the day.
      
      :param int `day`: the day


   .. method:: SetMargin(self, xmarg, ymarg)

      Set the margins
      
      :param `xmarg`: the 'x' margin
      :param `ymarg`: the 'y' margin


   .. method:: SetMonth(self, month)

      Set the Month.
      
      :param int `month`: the month


   .. method:: SetNow(self)

      Get the current day.


   .. method:: SetSelDay(self, sel)

      Set the days to highlight.
      
      :param list `sel`: the list of days to highlight


   .. method:: SetSize(self, set_size)

      Set the size.
      
      :param `set_size`: the control size. A value of (-1, -1) indicates a default size,
       chosen by either the windowing system or wxPython, depending on platform;
      :type `set_size`: tuple or :class:`wx.Size`


   .. method:: SetTextAlign(self, vert, horz)

      Set the text allignment.
      
      :param `vert`: the vertical allignment
      :param `horz`: the horizontal allignment


   .. method:: SetWeekColor(self, font_color, week_color)

      Set the week title color.
      
      :param `font_color`: the font color to use.
      :param `week_color`: the week color to use for the background.


   .. method:: SetYear(self, year)

      Set the year.
      
      :param int `year`: the year


   .. method:: ShowWeekEnd(self)

      Highlight the weekend.


   .. method:: TestDay(self, key)

      Test to see if the selection has a date and create event.
      
      :param `key`: the day to test


