def change_calendar(): print("Pobieranie danych o świętach...") cal = Calendar() temp2 = "" holidays = cal.get_holidays() for k, v in holidays.items(): temp2 = temp2 + "{} - {}\n".format(k, v) hol_val.set(temp2) u_hol_val.set(cal.get_unusual_day()) day_val.set(cal.get_day())
def create_calendar(): print("Tworzenie nowego kalendarza...") tk_cal = T_cal(root, selectmode='none', headersforeground='white', headersbackground='black', normalbackground='black', normalforeground='white', disabledbackground='black', disabledforeground='gray', weekendbackground='black', weekendforeground='gray', othermonthbackground='black', othermonthforeground='gray', othermonthwebackground='black', tooltipforeground='red', tooltipbackground='black', tooltipalpha=float(1), borderwidth=0, showothermonthdays=False, locale='pl_PL', selectbackground='gray') from cal import Calendar calendar = Calendar() for k, v in calendar.get_holidays().items(): k = k + str(' 10:47:14.489795') date = datetime.datetime.strptime(k, '%Y-%m-%d %H:%M:%S.%f') if v[0] == '!': tk_cal.calevent_create(date, v, 'other') else: tk_cal.calevent_create(date, v, 'holidays') tk_cal.tag_config('holidays', background='red', foreground='white') tk_cal.tag_config('other', background='green', foreground='white') tk_cal.pack(fill="none", expand=False) ttk.Label(root, textvariable=u_hol_val, background='black', foreground='white', justify='center').pack()