本文整理汇总了Python中calendar.Calendar.yeardays2calendar方法的典型用法代码示例。如果您正苦于以下问题:Python Calendar.yeardays2calendar方法的具体用法?Python Calendar.yeardays2calendar怎么用?Python Calendar.yeardays2calendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calendar.Calendar
的用法示例。
在下文中一共展示了Calendar.yeardays2calendar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_calendar_table
# 需要导入模块: from calendar import Calendar [as 别名]
# 或者: from calendar.Calendar import yeardays2calendar [as 别名]
def create_calendar_table(self):
self.calendar_layout.clear_widgets()
calendars = Calendar()
calendars.setfirstweekday(calendar.SUNDAY)
selected_month = self.month - 1
year_dates = calendars.yeardays2calendar(year=self.year, width=1)
th1 = KV.invoice_tr(0, 'Su')
th2 = KV.invoice_tr(0, 'Mo')
th3 = KV.invoice_tr(0, 'Tu')
th4 = KV.invoice_tr(0, 'We')
th5 = KV.invoice_tr(0, 'Th')
th6 = KV.invoice_tr(0, 'Fr')
th7 = KV.invoice_tr(0, 'Sa')
self.calendar_layout.add_widget(Builder.load_string(th1))
self.calendar_layout.add_widget(Builder.load_string(th2))
self.calendar_layout.add_widget(Builder.load_string(th3))
self.calendar_layout.add_widget(Builder.load_string(th4))
self.calendar_layout.add_widget(Builder.load_string(th5))
self.calendar_layout.add_widget(Builder.load_string(th6))
self.calendar_layout.add_widget(Builder.load_string(th7))
if year_dates[selected_month]:
for month in year_dates[selected_month]:
for week in month:
for day in week:
if day[0] > 0:
item = Factory.CalendarButton(text="[b]{}[/b]".format(day[0]))
else:
item = Factory.CalendarButton(disabled=True)
self.calendar_layout.add_widget(item)