gtk.Calendar
gtk.Calendar — a widget that displays a calendar and allows the user to
select a date.
Ancestry
Properties
Note
These properties are available in GTK+ 2.4 and above.
Signal Prototypes
"day-selected" | def callback(calendar, user_param1, ...) |
"day-selected-double-click" | def callback(calendar, user_param1, ...) |
"month-changed" | def callback(calendar, user_param1, ...) |
"next-month" | def callback(calendar, user_param1, ...) |
"next-year" | def callback(calendar, user_param1, ...) |
"prev-month" | def callback(calendar, user_param1, ...) |
"prev-year" | def callback(calendar, user_param1, ...) |
Description
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:
gtk.CALENDAR_SHOW_HEADING | Specifies that the month and year should be
displayed. |
gtk.CALENDAR_SHOW_DAY_NAMES | Specifies that three letter day descriptions should be
present. |
gtk.CALENDAR_NO_MONTH_CHANGE | Prevents the user from switching months with the
calendar. |
gtk.CALENDAR_SHOW_WEEK_NUMBERS | Displays each week numbers of the current year, down the
left side of the calendar. |
gtk.CALENDAR_WEEK_START_MONDAY | 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.
Constructor
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.
Methods
gtk.Calendar.select_month
def select_month(month, year)
|
month : | the new month number between 0 and
11 |
year : | 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.
gtk.Calendar.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.
gtk.Calendar.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.
gtk.Calendar.unmark_day
day : | the number of the day to be
unmarked |
Returns : | TRUE |
The unmark_day() method unmarks the
specified month day.
gtk.Calendar.clear_marks
The clear_marks() method clears all
marked days.
gtk.Calendar.get_display_options
def get_display_options()
|
Returns : | the calendar display options |
Note
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.
gtk.Calendar.set_display_options
def set_display_options(flags)
|
flags : | the new calendar display
options |
Note
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:
gtk.CALENDAR_SHOW_HEADING | Specifies that the month and year should be
displayed. |
gtk.CALENDAR_SHOW_DAY_NAMES | Specifies that three letter day descriptions should be
present. |
gtk.CALENDAR_NO_MONTH_CHANGE | Prevents the user from switching months with the
calendar. |
gtk.CALENDAR_SHOW_WEEK_NUMBERS | Displays each week numbers of the current year, down
the left side of the calendar. |
gtk.CALENDAR_WEEK_START_MONDAY | 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.
gtk.Calendar.display_options
def display_options(flags)
|
flags : | the new calendar display
options |
Warning
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:
gtk.CALENDAR_SHOW_HEADING | Specifies that the month and year should be
displayed. |
gtk.CALENDAR_SHOW_DAY_NAMES | Specifies that three letter day descriptions should be
present. |
gtk.CALENDAR_NO_MONTH_CHANGE | Prevents the user from switching months with the
calendar. |
gtk.CALENDAR_SHOW_WEEK_NUMBERS | Displays each week numbers of the current year, down
the left side of the calendar. |
gtk.CALENDAR_WEEK_START_MONDAY | 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.
gtk.Calendar.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).
gtk.Calendar.freeze
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.
gtk.Calendar.thaw
The thaw() method reenables the update
of the calendar after a freeze()
method is called. All changes made since the last freeze()
are displayed
Signals
The "day-selected" gtk.Calendar Signal
def callback(calendar, user_param1, ...)
|
calendar : | the calendar that received the
signal |
user_param1 : | the first user parameter (if any) specified
with the connect()
method |
... : | additional user parameters (if
any) |
The "day-selected" signal is emitted when a day is selected
either by the user or programatically.
The "day-selected-double-click" gtk.Calendar Signal
def callback(calendar, user_param1, ...)
|
calendar : | the calendar that received the
signal |
user_param1 : | the first user parameter (if any) specified
with the connect()
method |
... : | additional user parameters (if
any) |
The "day-selected-double-click" signal is emitted when a
calendar day is doubled-clicked by the user.
The "month-changed" gtk.Calendar Signal
def callback(calendar, user_param1, ...)
|
calendar : | the calendar that received the
signal |
user_param1 : | the first user parameter (if any) specified
with the connect()
method |
... : | additional user parameters (if
any) |
The "month-changed" signal is emitted when the calendar month is
changed programatically or by the user.
The "next-month" gtk.Calendar Signal
def callback(calendar, user_param1, ...)
|
calendar : | the calendar that received the
signal |
user_param1 : | the first user parameter (if any) specified
with the connect()
method |
... : | additional user parameters (if
any) |
The "next-month" signal is emitted when the user clicks the
"next-month" navigation control in the calendar header.
The "next-year" gtk.Calendar Signal
def callback(calendar, user_param1, ...)
|
calendar : | the calendar that received the
signal |
user_param1 : | the first user parameter (if any) specified
with the connect()
method |
... : | additional user parameters (if
any) |
The "next-year" signal is emitted when the user clicks the
"next-year" navigation control in the calendar header.
The "prev-month" gtk.Calendar Signal
def callback(calendar, user_param1, ...)
|
calendar : | the calendar that received the
signal |
user_param1 : | the first user parameter (if any) specified
with the connect()
method |
... : | additional user parameters (if
any) |
The "prev-month" signal is emitted when the user clicks the
"prev-month" navigation control in the calendar header.
The "prev-year" gtk.Calendar Signal
def callback(calendar, user_param1, ...)
|
calendar : | the calendar that received the
signal |
user_param1 : | the first user parameter (if any) specified
with the connect()
method |
... : | additional user parameters (if
any) |
The "prev-year" signal is emitted when the user clicks the
"prev-year" navigation control in the calendar header.