gtk.Calendar — a widget that displays a calendar and allows the user to select a date.
class gtk.Calendar(gtk.Widget): |
These properties are available in GTK+ 2.4 and above.
|
|
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( |
The gtk.Calendar
is a
widget that displays a simple calendar, one month at a time. In addition,
the calendar can display the days of the week and navigation controls that
allow a user to change the month and year displayed by calling the display_options
()
(set_display_options
()
in PyGTK 2.4 and above) method. The possible display options are:
| Specifies that the month and year should be displayed. |
| Specifies that three letter day descriptions should be present. |
| Prevents the user from switching months with the calendar. |
| Displays each week numbers of the current year, down the left side of the calendar. |
| Starts the calendar week on Monday, instead of the default Sunday. |
The month and year currently displayed are programatically
changed by calling the select_month
()
method. The exact day is selected from the displayed month using the select_day
()
method.
To place a visual marker on a particular day, use the mark_day
()
method and to remove the marker, the unmark_day
()
method. All marks are cleared by calling the clear_marks
()
method.
The selected date can be retrieved from a gtk.Calendar
using
the get_date
()
method. If performing many 'mark' operations, the calendar can be frozen to
prevent flicker, using the freeze
()
method, and 'thawed' again using the thaw
()
method.
Note that month is zero-based (i.e it allowed values are 0-11) while selected_day is one-based (i.e. allowed values are 1-31).
gtk.Calendar()
Returns : | a calendar object |
Creates a calendar object that displays the current month and year with the current day selected. The default calendar display style is: gtk.CALENDAR_SHOW_HEADING | gtk.CALENDAR_SHOW_DAY_NAMES that shows the days of the week and the month and year heading with navigation controls.
def select_month(month
, year
)
| the new month number between 0 and 11 |
| the new year number |
Returns : | True if the month is set |
The select_month
() method changes the
calendar display to the specified month
and
year
.
def select_day(day
)
| the new day number between 1 and 31 - 0 removes the current selection |
The select_day
() method selects the
specified day
on the calendar when
day
has a value between 1 and 31. If
day
is 0 then the current day selection is
removed.
def mark_day(day
)
| the number of the day to be marked |
Returns : | True |
The mark_day
() method marks the
specified month day
with a visual marker (typically
by making the number bold). If the calendar month and year are changed the
marked days remain marked.
def unmark_day(day
)
| the number of the day to be unmarked |
Returns : | True |
The unmark_day
() method unmarks the
specified month day
.
def get_display_options()
Returns : | the calendar display options |
This method is available in PyGTK 2.4 and above.
The get_display_options
() method
returns the current calendar display options. See the set_display_options
()
method for more information.
def set_display_options(flags
)
| the new calendar display options |
This method is available in PyGTK 2.4 and above.
The set_display_options
() method sets the
calendar display options to the value specified by
flags
. The possible display options are a combination
of:
| Specifies that the month and year should be displayed. |
| Specifies that three letter day descriptions should be present. |
| Prevents the user from switching months with the calendar. |
| Displays each week numbers of the current year, down the left side of the calendar. |
| Starts the calendar week on Monday, instead of the default Sunday. |
The display options can be removed by passing 0 as the value of
flags
.
def get_detail_height_rows()
Returns : | The height of detail cells, in rows. |
This method is available in PyGTK 2.14 and above.
The get_detail_height_rows
() method
queries the height of detail cells, in rows. See the "detail-width-chars" property.
def set_detail_height_rows(rows
)
| detail height in rows. |
This method is available in PyGTK 2.14 and above.
The set_detail_height_rows
() method
updates the height of detail cells. See the "detail-height-rows" property.
def get_detail_width_chars()
Returns : | The width of detail cells, in characters. |
This method is available in PyGTK 2.14 and above.
The get_detail_width_chars
() method
queries the width of detail cells, in characters. See the "detail-width-chars" property.
def set_detail_width_chars(chars
)
| detail width in characters. |
This method is available in PyGTK 2.14 and above.
The set_detail_width_chars
() method
updates the width of detail cells. See the "detail-width-chars" property.
def display_options(flags
)
| the new calendar display options |
This method is deprecated in PyGTK 2.4 and should be replaced
by the set_display_options
()
method.
The display_options
() method sets the
calendar display options to the value specified by
flags
. The possible display options are a combination
of:
| Specifies that the month and year should be displayed. |
| Specifies that three letter day descriptions should be present. |
| Prevents the user from switching months with the calendar. |
| Displays each week numbers of the current year, down the left side of the calendar. |
| Starts the calendar week on Monday, instead of the default Sunday. |
The display options can be removed by passing 0 as the value of
flags
.
def get_date()
Returns : | a tuple containing the year, month and day |
The get_date
() method retrieves the
calendar's current year, month and selected day numbers as a tuple (year,
month, day).
Note that month is zero-based (i.e it allowed values are 0-11) while selected_day is one-based (i.e. allowed values are 1-31).
def freeze()
This method is deprecated since PyGTK 2.8 and should not be used in newly-written code.
The freeze
() method stops the update of
the calendar display until the thaw
()
method is called. This method is used to reduce calendar flicker when doing
a large number of updates to the calendar.
def callback(calendar
, user_param1
, ...
)
| the calendar that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "day-selected" signal is emitted when a day is selected either by the user or programatically.
def callback(calendar
, user_param1
, ...
)
| the calendar that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "day-selected-double-click" signal is emitted when a calendar day is doubled-clicked by the user.
def callback(calendar
, user_param1
, ...
)
| the calendar that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "month-changed" signal is emitted when the calendar month is changed programatically or by the user.
def callback(calendar
, user_param1
, ...
)
| the calendar that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "next-month" signal is emitted when the user clicks the "next-month" navigation control in the calendar header.
def callback(calendar
, user_param1
, ...
)
| the calendar that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "next-year" signal is emitted when the user clicks the "next-year" navigation control in the calendar header.
def callback(calendar
, user_param1
, ...
)
| the calendar that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "prev-month" signal is emitted when the user clicks the "prev-month" navigation control in the calendar header.
def callback(calendar
, user_param1
, ...
)
| the calendar that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "prev-year" signal is emitted when the user clicks the "prev-year" navigation control in the calendar header.