:right-sidebar: True Calendar =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: Calendar(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` :Constructors: :: Calendar(**properties) new() -> Gtk.Widget Constructors ------------ .. rst-class:: interim-class .. class:: Calendar :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Creates a new calendar, with the current date being selected. Methods ------- .. rst-class:: interim-class .. class:: Calendar :no-index: .. method:: clear_marks() -> None Remove all visual markers. .. method:: get_date() -> ~gi.repository.GLib.DateTime Returns a ``GDateTime`` representing the shown year, month and the selected day. The returned date is in the local time zone. .. method:: get_day() -> int Gets the day of the selected date. .. versionadded:: 4.14 .. method:: get_day_is_marked(day: int) -> bool Returns if the ``day`` of the ``calendar`` is already marked. :param day: the day number between 1 and 31. .. method:: get_month() -> int Gets the month of the selected date. .. versionadded:: 4.14 .. method:: get_show_day_names() -> bool Returns whether ``self`` is currently showing the names of the week days. This is the value of the :obj:`~gi.repository.Gtk.Calendar.props.show_day_names` property. .. method:: get_show_heading() -> bool Returns whether ``self`` is currently showing the heading. This is the value of the :obj:`~gi.repository.Gtk.Calendar.props.show_heading` property. .. method:: get_show_week_numbers() -> bool Returns whether ``self`` is showing week numbers right now. This is the value of the :obj:`~gi.repository.Gtk.Calendar.props.show_week_numbers` property. .. method:: get_year() -> int Gets the year of the selected date. .. versionadded:: 4.14 .. method:: mark_day(day: int) -> None Places a visual marker on a particular day of the current month. :param day: the day number to mark between 1 and 31. .. method:: select_day(date: ~gi.repository.GLib.DateTime) -> None Switches to ``date``'s year and month and select its day. :param date: a ``GDateTime`` representing the day to select .. method:: set_day(day: int) -> None Sets the day for the selected date. The new date must be valid. For example, setting 31 for the day when the month is February, fails. .. versionadded:: 4.14 :param day: The desired day for the selected date (as a number between 1 and 31). .. method:: set_month(month: int) -> None Sets the month for the selected date. The new date must be valid. For example, setting 1 (February) for the month when the day is 31, fails. .. versionadded:: 4.14 :param month: The desired month for the selected date (as a number between 0 and 11). .. method:: set_show_day_names(value: bool) -> None Sets whether the calendar shows day names. :param value: Whether to show day names above the day numbers .. method:: set_show_heading(value: bool) -> None Sets whether the calendar should show a heading. The heading contains the current year and month as well as buttons for changing both. :param value: Whether to show the heading in the calendar .. method:: set_show_week_numbers(value: bool) -> None Sets whether week numbers are shown in the calendar. :param value: whether to show week numbers on the left of the days .. method:: set_year(year: int) -> None Sets the year for the selected date. The new date must be valid. For example, setting 2023 for the year when then the date is 2024-02-29, fails. .. versionadded:: 4.14 :param year: The desired year for the selected date (within :obj:`~gi.repository.GLib.DateTime` limits, i.e. from 0001 to 9999). .. method:: unmark_day(day: int) -> None Removes the visual marker from a particular day. :param day: the day number to unmark between 1 and 31. Properties ---------- .. rst-class:: interim-class .. class:: Calendar :no-index: .. attribute:: props.day :type: int The selected day (as a number between 1 and 31). .. attribute:: props.month :type: int The selected month (as a number between 0 and 11). This property gets initially set to the current month. .. attribute:: props.show_day_names :type: bool Determines whether day names are displayed. .. attribute:: props.show_heading :type: bool Determines whether a heading is displayed. .. attribute:: props.show_week_numbers :type: bool Determines whether week numbers are displayed. .. attribute:: props.year :type: int The selected year. This property gets initially set to the current year. Signals ------- .. rst-class:: interim-class .. class:: Calendar.signals :no-index: .. method:: day_selected() -> None Emitted when the user selects a day. .. method:: next_month() -> None Emitted when the user switched to the next month. .. method:: next_year() -> None Emitted when user switched to the next year. .. method:: prev_month() -> None Emitted when the user switched to the previous month. .. method:: prev_year() -> None Emitted when user switched to the previous year.