Calendar

class ttkwidgets.Calendar(master=None, **kw)[source]

Bases: ttk.Frame

ttk Widget that enables a calender within a frame, allowing the user to select dates.

Credits to: The Python team
Source: The Python/ttk samples
License: The Python GPL-compatible license
__init__(master=None, **kw)[source]

Create a Calendar.

Parameters:
  • master (widget) – master widget
  • locale (str) – calendar locale (defines the language, date formatting)
  • firstweekday (int) – first day of the week, 0 is monday
  • year (int) – year to display
  • month (int) – month to display
  • selectbackground (str) – background color of the selected day
  • selectforeground (str) – selectforeground color of the selected day
  • kw – options to be passed on to the ttk.Frame initializer
class datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])

Bases: datetime.date

The year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints or longs.

astimezone()

tz -> convert to local time in new timezone tz

combine()

date, time -> datetime with same date and time fields

ctime()

Return ctime() style string.

date()

Return date object with same year, month and day.

dst()

Return self.tzinfo.dst(self).

fromtimestamp()

timestamp[, tz] -> tz’s local time from POSIX timestamp.

isoformat()

[sep] -> string in ISO 8601 format, YYYY-MM-DDTHH:MM:SS[.mmmmmm][+HH:MM].

sep is used to separate the year from the time, and defaults to ‘T’.

now()

[tz] -> new datetime with tz’s local day and time.

replace()

Return datetime with new specified fields.

strptime()

string, format -> new datetime parsed from a string (like time.strptime()).

time()

Return time object with same time but with tzinfo=None.

timetuple()

Return time tuple, compatible with time.localtime().

timetz()

Return time object with same time and tzinfo.

tzname()

Return self.tzinfo.tzname(self).

utcfromtimestamp()

timestamp -> UTC datetime from a POSIX timestamp (like time.time()).

utcnow()

Return a new datetime representing UTC day and time.

utcoffset()

Return self.tzinfo.utcoffset(self).

utctimetuple()

Return UTC time tuple, compatible with time.localtime().

selection

Return the currently selected date.

Return type:datetime
class timedelta

Bases: object

Difference between two datetime values.

days

Number of days.

microseconds

Number of microseconds (>= 0 and less than 1 second).

seconds

Number of seconds (>= 0 and less than 1 day).

total_seconds()

Total seconds in the duration.