Gtk.Calendar

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Buildable->Gtk.Widget Gtk.Calendar Gtk.Calendar Gtk.Widget->Gtk.Calendar

Subclasses:

None

Methods

Inherited:

Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)

Structs:

Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new ()

clear_marks ()

get_date ()

get_day_is_marked (day)

get_detail_height_rows ()

get_detail_width_chars ()

get_display_options ()

mark_day (day)

select_day (day)

select_month (month, year)

set_detail_func (func, *data)

set_detail_height_rows (rows)

set_detail_width_chars (chars)

set_display_options (flags)

unmark_day (day)

Virtual Methods

Inherited:

Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

do_day_selected ()

do_day_selected_double_click ()

do_month_changed ()

do_next_month ()

do_next_year ()

do_prev_month ()

do_prev_year ()

Properties

Inherited:

Gtk.Widget (39)

Name

Type

Flags

Short Description

day

int

r/w/en

The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day)

detail-height-rows

int

r/w/en

Details height in rows

detail-width-chars

int

r/w/en

Details width in characters

month

int

r/w/en

The selected month (as a number between 0 and 11)

no-month-change

bool

r/w/en

If True, the selected month cannot be changed

show-day-names

bool

r/w/en

If True, day names are displayed

show-details

bool

r/w/en

If True, details are shown

show-heading

bool

r/w/en

If True, a heading is displayed

show-week-numbers

bool

r/w/en

If True, week numbers are displayed

year

int

r/w/en

The selected year

Style Properties

Inherited:

Gtk.Widget (17)

Name

Type

Default

Flags

Short Description

horizontal-separation

int

4

r

Space between week headers and main area

inner-border

int

4

r

Inner border space

vertical-separation

int

4

r

Space between day headers and main area

Signals

Inherited:

Gtk.Widget (69), GObject.Object (1)

Name

Short Description

day-selected

Emitted when the user selects a day.

day-selected-double-click

Emitted when the user double-clicks a day.

month-changed

Emitted when the user clicks a button to change the selected month on a calendar.

next-month

Emitted when the user switched to the next month.

next-year

Emitted when user switched to the next year.

prev-month

Emitted when the user switched to the previous month.

prev-year

Emitted when user switched to the previous year.

Fields

Inherited:

Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

widget

Gtk.Widget

r

Class Details

class Gtk.Calendar(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

Gtk.CalendarClass

Gtk.Calendar is a widget that displays a Gregorian calendar, one month at a time. It can be created with Gtk.Calendar.new().

The month and year currently displayed can be altered with Gtk.Calendar.select_month(). The exact day can be selected from the displayed month using Gtk.Calendar.select_day().

To place a visual marker on a particular day, use Gtk.Calendar.mark_day() and to remove the marker, Gtk.Calendar.unmark_day(). Alternative, all marks can be cleared with Gtk.Calendar.clear_marks().

The way in which the calendar itself is displayed can be altered using Gtk.Calendar.set_display_options().

The selected date can be retrieved from a Gtk.Calendar using Gtk.Calendar.get_date().

Users should be aware that, although the Gregorian calendar is the legal calendar in most countries, it was adopted progressively between 1582 and 1929. xlib.Display before these dates is likely to be historically incorrect.

classmethod new()[source]
Returns:

a newly Gtk.Calendar widget

Return type:

Gtk.Widget

Creates a new calendar, with the current date being selected.

clear_marks()[source]

Remove all visual markers.

get_date()[source]
Returns:

year:

location to store the year as a decimal number (e.g. 2011), or None

month:

location to store the month number (between 0 and 11), or None

day:

location to store the day number (between 1 and 31), or None

Return type:

(year: int, month: int, day: int)

Obtains the selected date from a Gtk.Calendar.

get_day_is_marked(day)[source]
Parameters:

day (int) – the day number between 1 and 31.

Returns:

whether the day is marked.

Return type:

bool

Returns if the day of the self is already marked.

New in version 3.0.

get_detail_height_rows()[source]
Returns:

The height of detail cells, in rows.

Return type:

int

Queries the height of detail cells, in rows. See Gtk.Calendar :detail-width-chars.

New in version 2.14.

get_detail_width_chars()[source]
Returns:

The width of detail cells, in characters.

Return type:

int

Queries the width of detail cells, in characters. See Gtk.Calendar :detail-width-chars.

New in version 2.14.

get_display_options()[source]
Returns:

the display options.

Return type:

Gtk.CalendarDisplayOptions

Returns the current display options of self.

New in version 2.4.

mark_day(day)[source]
Parameters:

day (int) – the day number to mark between 1 and 31.

Places a visual marker on a particular day.

select_day(day)[source]
Parameters:

day (int) – the day number between 1 and 31, or 0 to unselect the currently selected day.

Selects a day from the current month.

select_month(month, year)[source]
Parameters:
  • month (int) – a month number between 0 and 11.

  • year (int) – the year the month is in.

Shifts the calendar to a different month.

set_detail_func(func, *data)[source]
Parameters:

Installs a function which provides Pango markup with detail information for each day. Examples for such details are holidays or appointments. That information is shown below each day when Gtk.Calendar :show-details is set. A tooltip containing with full detail information is provided, if the entire text should not fit into the details area, or if Gtk.Calendar :show-details is not set.

The size of the details area can be restricted by setting the Gtk.Calendar :detail-width-chars and Gtk.Calendar :detail-height-rows properties.

New in version 2.14.

set_detail_height_rows(rows)[source]
Parameters:

rows (int) – detail height in rows.

Updates the height of detail cells. See Gtk.Calendar :detail-height-rows.

New in version 2.14.

set_detail_width_chars(chars)[source]
Parameters:

chars (int) – detail width in characters.

Updates the width of detail cells. See Gtk.Calendar :detail-width-chars.

New in version 2.14.

set_display_options(flags)[source]
Parameters:

flags (Gtk.CalendarDisplayOptions) – the display options to set

Sets display options (whether to display the heading and the month headings).

New in version 2.4.

unmark_day(day)[source]
Parameters:

day (int) – the day number to unmark between 1 and 31.

Removes the visual marker from a particular day.

do_day_selected() virtual
do_day_selected_double_click() virtual
do_month_changed() virtual
do_next_month() virtual
do_next_year() virtual
do_prev_month() virtual
do_prev_year() virtual

Signal Details

Gtk.Calendar.signals.day_selected(calendar)
Signal Name:

day-selected

Flags:

RUN_FIRST

Parameters:

calendar (Gtk.Calendar) – The object which received the signal

Emitted when the user selects a day.

Gtk.Calendar.signals.day_selected_double_click(calendar)
Signal Name:

day-selected-double-click

Flags:

RUN_FIRST

Parameters:

calendar (Gtk.Calendar) – The object which received the signal

Emitted when the user double-clicks a day.

Gtk.Calendar.signals.month_changed(calendar)
Signal Name:

month-changed

Flags:

RUN_FIRST

Parameters:

calendar (Gtk.Calendar) – The object which received the signal

Emitted when the user clicks a button to change the selected month on a calendar.

Gtk.Calendar.signals.next_month(calendar)
Signal Name:

next-month

Flags:

RUN_FIRST

Parameters:

calendar (Gtk.Calendar) – The object which received the signal

Emitted when the user switched to the next month.

Gtk.Calendar.signals.next_year(calendar)
Signal Name:

next-year

Flags:

RUN_FIRST

Parameters:

calendar (Gtk.Calendar) – The object which received the signal

Emitted when user switched to the next year.

Gtk.Calendar.signals.prev_month(calendar)
Signal Name:

prev-month

Flags:

RUN_FIRST

Parameters:

calendar (Gtk.Calendar) – The object which received the signal

Emitted when the user switched to the previous month.

Gtk.Calendar.signals.prev_year(calendar)
Signal Name:

prev-year

Flags:

RUN_FIRST

Parameters:

calendar (Gtk.Calendar) – The object which received the signal

Emitted when user switched to the previous year.

Property Details

Gtk.Calendar.props.day
Name:

day

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The selected day (as a number between 1 and 31, or 0 to unselect the currently selected day). This property gets initially set to the current day.

Gtk.Calendar.props.detail_height_rows
Name:

detail-height-rows

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Height of a detail cell, in rows. A value of 0 allows any width. See Gtk.Calendar.set_detail_func().

New in version 2.14.

Gtk.Calendar.props.detail_width_chars
Name:

detail-width-chars

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Width of a detail cell, in characters. A value of 0 allows any width. See Gtk.Calendar.set_detail_func().

New in version 2.14.

Gtk.Calendar.props.month
Name:

month

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The selected month (as a number between 0 and 11). This property gets initially set to the current month.

Gtk.Calendar.props.no_month_change
Name:

no-month-change

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines whether the selected month can be changed.

New in version 2.4.

Gtk.Calendar.props.show_day_names
Name:

show-day-names

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines whether day names are displayed.

New in version 2.4.

Gtk.Calendar.props.show_details
Name:

show-details

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines whether details are shown directly in the widget, or if they are available only as tooltip. When this property is set days with details are marked.

New in version 2.14.

Gtk.Calendar.props.show_heading
Name:

show-heading

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines whether a heading is displayed.

New in version 2.4.

Gtk.Calendar.props.show_week_numbers
Name:

show-week-numbers

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines whether week numbers are displayed.

New in version 2.4.

Gtk.Calendar.props.year
Name:

year

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The selected year. This property gets initially set to the current year.