def _orderDateFun(self, ver): def print_sel(): if ver == 0: self._orderDate = cal.selection_get() self.DateOrderLabel.config(text=str(self._orderDate.day) + '-' + str(self._orderDate.month) + '-' + str(self._orderDate.year)) elif ver == 1: self._collectDate = cal.selection_get() self.DateCollectLabel.config(text=str(self._collectDate.day) + '-' + str(self._collectDate.month) + '-' + str(self._collectDate.year)) top.destroy() top = Toplevel(self.root) today = datetime.date.today() cal = Calendar(top, font="Arial 14", selectmode='day', disabledforeground='red', cursor="hand1", year=today.year, month=today.month, day=today.day) cal.pack(fill="both", expand=True) Button(top, text="zatwierdź", command=print_sel).pack()
def dateSelector(): def print_sel(): global date_selected dateselected = cal.selection_get() date_selected = dateselected print(dateselected) labelstatus = ttk.Label(top, text="Close this window.",width=20,font=("bold", 12)).pack() label_3 = ttk.Label(labelframe_2, text=dateselected,width=30,font=("bold", 10)) label_3.grid(row=4,column = 6, pady=4) top.destroy() return dateselected top = Toplevel(ingoal) import datetime today = datetime.date.today() mindate = datetime.date(year=2000, month=5, day=1) maxdate = today + datetime.timedelta(days=100) cal = Calendar(top, font="Arial 14", selectmode='day', locale='en_US', mindate=mindate, maxdate=maxdate, disabledforeground='red', cursor="hand1", year=2020, month=5, day=5) cal.pack(fill="both", expand=True) incomebtn2 = ttk.Button(top, text="Select", command=print_sel).pack()
def newreminder(): def newremind(message): with open("remind.txt","a+") as f: f.write(f"{message.get()} on {cal.selection_get()}\n") cal.see(datetime.date(year=2016, month=2, day=5)) print(message.get(),cal.selection_get()) newtop = Toplevel(root) msg=StringVar() import datetime today = datetime.date.today() mindate = datetime.date(year=2018, month=1, day=21) maxdate = today + datetime.timedelta(days=5) print(mindate, maxdate) cal = Calendar(newtop, font="Arial 14", selectmode='day', locale='en_US', mindate=mindate, maxdate=maxdate, disabledforeground='red', cursor="hand1", year=2018, month=2, day=5) cal.grid(row=1,column=0,columnspan=2) lable1=Label(newtop,text="Enter Your Message").grid(row=0,column=0) receivemessage=Entry(newtop,textvariable=msg,width=35).grid(row=0,column=1) submit=Button(newtop,text="Submit Reminder",command=lambda:newremind(msg)).grid(row=2,column=1)
def tkinterCalendar(self, event): # respuesta = tk.messagebox.askquestion(parent=self, message="¿Cuenta con la fecha especifica? \n\n Conteste NO para guardar como PENDIENTE", title="Agregar fecha",icon = 'info') # if respuesta == 'yes': def print_sel(): f = (cal.selection_get()).weekday() if f < 5: event.widget.config(state="normal") self.updateDate(cal.selection_get()) event.widget.delete(0, tk.END) event.widget.insert(0, cal.selection_get()) event.widget.config(state="disabled") top.destroy() else: tk.messagebox.showerror(parent=top, message="Por favor elija un dia valido", title="Seleccionar fecha") def print_pendiente(): event.widget.config(state="normal") self.updateDate(cal.selection_get()) event.widget.delete(0, tk.END) event.widget.insert(0, 'Pediente') event.widget.config(state="disabled") top.destroy() top = tk.Toplevel(self) cal = Calendar(top, font="Arial 14", selectmode='day', cursor="hand1", year=self.anio, month=self.mes, day=self.dia) cal.pack(fill="both", expand=True) ttk.Button(top, text="ok", command=print_sel).pack(expand=True, fill=tk.BOTH, ipadx=10, ipady=10, pady=2) ttk.Button(top, text="Guardar como pendiente", command= print_pendiente).pack(expand=True, fill=tk.BOTH, ipadx=10, ipady=10, pady=2)
def odczytaj(self): self.newWindow1 = tk.Toplevel(self.master) self.ramka1 = tk.Frame(self.newWindow1, bg='blue', bd=2) self.ramka1.grid() self.szukajd = tk.Label( self.ramka1, text="SZUKAJ PO DACIE", font=('Calibri Light', 15)) self.szukajd.grid(column=0, row=0) self.szukajde = Calendar(self.ramka1) self.szukajde.grid(column=0, row=2) self.szukajdb = Button(self.ramka1, text="SZUKAJ!", bg="slategray2", font=('Calibri Light', 15), command=self.wyniki2) self.szukajdb.grid(column=0, row=4) self.separator = Frame(self.newWindow1, height=3, width=300, bg="slategray4") self.separator.grid(column=0, row=5) self.szukajt = tk.Label( self.newWindow1, text="SZUKAJ PO TYTULE", font=('Calibri Light', 15)) self.szukajt.grid(column=0, row=5) self.szukajte = tk.Entry(self.newWindow1, width=40) self.szukajte.grid(column=0, row=7) self.szukajtb = Button( self.newWindow1, text="SZUKAJ!", bg="slategray2", font=('Calibri Light', 15), command=self.wyniki) self.szukajtb.grid(column=0, row=9) self.newWindow1.grid_rowconfigure(3, minsize=10) self.newWindow1.grid_rowconfigure(5, minsize=30) self.newWindow1.grid_rowconfigure(8, minsize=30) self.newWindow1.grid_rowconfigure(10, minsize=30) self.szukajte.grid(column=0, row=6) #self.szukajtb = Button( # self.newWindow1, text="Szukaj!", command=lambda: self.searchDatabase(self.szukajte.get())) self.szukajtb = Button( self.newWindow1, text="Szukaj!", command=self.wyniki) self.szukajtb.grid(column=0, row=7)
def calendar(self): """ So far only displays calendar.""" def print_sel(): print(cal.selection_get()) cal.see(datetime.date(year=2021, month=2, day=2)) top = self.root today = datetime.date.today() maxdate = datetime.date(year=2022, month=1, day=1) mindate = today + datetime.timedelta(days=5) print(mindate, maxdate) cal = Calendar(top, font="Arial 14", selectmode='day', locale='en_US', mindate=mindate, maxdate=maxdate, disabledforeground='red', cursor="hand1", year=2018, month=2, day=5) cal.pack() ttk.Button(top, text="ok", command=print_sel).pack()
def example1(): '''def doo(): cr = sheet.max_row sheet.cell(row=cr + 1, column=1).value = w.get() sheet.cell(row=cr + 1, column=2).value = y.get() sheet.cell(row=cr + 1, column=3).value = R sheet.cell(row=cr + 1, column=4).value = cal.selection_get() sheet.cell(row=cr + 1, column=5).value = t.get() fb.save('Database1.xlsx') main = tk.Tk() ourMessage ='Your ride will arrive in minute' messageVar = Message(main, text = ourMessage) messageVar.pack( ) main.mainloop( ) ''' def fu(): global fu2 fu2 = cal.selection_get() top = tk.Toplevel(root) cal = Calendar(top, font="Arial 14", selectmode='day', cursor="hand1", year=2019, month=11, day=5) cal.pack(fill="both", expand=True) ttk.Button(top, text="ok", command=fu).pack()
def calendar(): def scrapy_start(): start=cal.selection_get() cal.see(datetime.date(year=2020, month=11, day=1)) string_date.append(start) def scrapy_end(): end=cal.selection_get() cal.see(datetime.date(year=2020, month=11, day=1)) string_date.append(end) top = tk.Toplevel(root) import datetime today = datetime.date.today() mindate = datetime.date(year=2017, month=1, day=1) maxdate = today + datetime.timedelta(days=5) cal = Calendar(top, font="Arial 14", selectmode='day', locale='en_US', mindate=mindate, maxdate=maxdate, disabledforeground='red', cursor="hand1", year=maxdate.year, month=maxdate.month, day=maxdate.day) cal.pack(fill="both", expand=True) ttk.Button(top, text="Set Start", command=scrapy_start).pack() ttk.Button(top, text="Set End", command=scrapy_end).pack()
def create_widgets(self): self.selected_date = StringVar() cal = Calendar(self, selectmode='day', locale='en_US', date_pattern="yyyy-mm-dd", maxdate=datetime.date.today(), disabledforeground='red', textvariable=self.selected_date) cal.grid(column=0, row=0, columnspan=2, sticky='nesw') self.shift = StringVar() ttk.Radiobutton(self, text='day', variable=self.shift, value='day').grid(column=0, row=2, sticky='e') ttk.Radiobutton(self, text='night', variable=self.shift, value='night').grid(column=1, row=2, sticky='w') self.uid = StringVar() uid_entry = Entry(self, textvariable=self.uid) uid_entry.grid(column=1, row=3, sticky=(W, E)) uid_entry.focus() self.pw = StringVar() Entry(self, textvariable=self.pw, show='*').grid(column=1, row=4, sticky=(W, E)) ttk.Button(self, text='Submit', command=self.submit).grid(column=0, row=5, sticky='we') ttk.Button(self, text='Quit', command=self.stop).grid(column=1, row=5, sticky='we')
def __init__(self, parent, controller): View.__init__(self, parent, controller) self.mindate = datetime.date.today() - datetime.timedelta(days=30) self.calendar = Calendar(self, font="Comic_Sans 14", selectmode='day', locale='en_US', mindate=self.mindate, disabledforeground='red', cursor="hand2") self.calendar.tag_config('Komunia', background='yellow', foreground='black') self.calendar.tag_config('Wesele', background='red', foreground='black') self.calendar.tag_config('Spotkanie biznesowe', background='blue', foreground='white') self.calendar.tag_config('Urodziny', background='black', foreground='yellow') self.button_frame = tk.Frame(self) self.buttons = [] self.__build_grid() self.grid_columnconfigure(0, weight=1)
def Calendrier(): def print_sel(): #bouton_ok.pack_forget() valeur_cal = cal.selection_get() print("la date est", cal.selection_get()) label = Label(fenetre, text=cal.selection_get().strftime('%d/%m/%Y'), bg="grey").pack(padx=30, pady=10) # Label cal.destroy() def recupere_date(): return cal.selection_get() cal = Calendar(fenetre, font="Arial 14", selectmode='day', locale='en_US', cursor="hand1", year=2018, month=2, day=5) cal.pack(fill="both", expand=True) bouton_ok = ttk.Button(fenetre, text="ok", command=print_sel).pack() bouton_ok.bind("<Button-1>", print_sel) # clic gauche
def test_calendar_virtual_events(self): widget = Calendar(self.window) widget.pack() self.window.update() self.event_triggered = False def binding(event): self.event_triggered = True widget.bind('<<CalendarSelected>>', binding) widget._on_click(TestEvent(widget=widget._calendar[2][1])) self.window.update() self.assertTrue(self.event_triggered) widget.bind('<<CalendarMonthChanged>>', binding) self.event_triggered = False widget._l_month.invoke() self.window.update() self.assertTrue(self.event_triggered) self.event_triggered = False widget._r_month.invoke() self.window.update() self.assertTrue(self.event_triggered) self.event_triggered = False widget._l_year.invoke() self.window.update() self.assertTrue(self.event_triggered) self.event_triggered = False widget._r_year.invoke() self.window.update() self.assertTrue(self.event_triggered)
def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) #Create calendar self.cal = Calendar(self, font="Arial 14", selectmode='day', tooltipforeground='black', tooltipbackground='pink', tooltipalpha='1', tooltipdelay='0') date = self.cal.datetime.today() #Add in events self.cal.c1 = self.cal.calevent_create( date + self.cal.timedelta(days=5), "F**k me in the ass", 'message') self.cal.calevent_create(date, 'Bake cookies at 3am', 'reminder') self.cal.calevent_create(date + self.cal.timedelta(days=-2), 'Date at McDonalds', 'reminder') self.cal.calevent_create(date + self.cal.timedelta(days=3), 'Mine Diamonds with Jimothy', 'message') #Set calendar and adjust colours self.cal.tag_config('reminder', background='red', foreground='yellow') self.cal.pack(fill="both", expand=True) #Set status/tool tip bar self.l2 = tk.Label(self, text="Click on a date to check for events!", width=40) self.l2.pack(side="bottom") #Executes "set_date" when a day is clicked self.cal.bind("<<CalendarSelected>>", self.set_date)
def enterDate(): '''Let user set the date''' top = Toplevel(window_2) topText = 'Choose Date' top.title(topText) top.geometry('300x300+30+30') chooseDateText = 'Please click to choose a date' chooseDateLabel = Label(top, padx=10, pady=10, text=chooseDateText) chooseDateLabel.pack() mindate = currentDatePara maxdate = mindate + datetime.timedelta(days=365) cal = Calendar(top, mindate=mindate, maxdate=maxdate, width=12, background='darkblue', foreground='white', borderwidth=2) cal.pack(padx=10, pady=10) def getUserDate(): global userDate userDate = cal.selection_get() dateLabel['text']=userDate #update userDate in the dateLabel of window_2 top.destroy() # end of getUserDate() okDateButton = Button(top, padx=10, pady=5, bg='purple', fg='white', text='OK', command=getUserDate) okDateButton.pack()
def pickDateCmd(self): def print_sel(): #print(cal.selection_get()) global expenseDate expenseDate = cal.selection_get() #print(expenseDate) win = tk.Toplevel(self) win.resizable(0,0) # Get full day today = date.strftime(date.today(), '%Y-%m-%d') # Strip year fyear = int(today[:4]) # Strip month tmp_month = today[5:7] if tmp_month[0] == "0": fmonth = int(tmp_month[1]) else: fmonth = int(tmp_month) # Strip day tmp_day = today[8:10] if tmp_day[0] == "0": fday = int(tmp_day[1]) else: fday = int(tmp_day) cal = Calendar(win, font="Arial 7", selectmode='day', cursor="hand1", year=fyear, month=fmonth, day=fday) cal.pack(fill="both", expand=True) ttk.Button(win, text="ok", command=print_sel).pack()
class Cal: def __init__(self, root): self.date = '' self.top = tk.Toplevel(root) self.top.title('Select Start Date') self.cal = Calendar( self.top, font='Arial 14', selectmode='day', cursor='hand1', ) self.cal.pack(fill='both', expand=True) tk.Button(self.top, text='OK', command=self.set_date).pack() tk.Button(self.top, text='Close', command=self.quit).pack() def set_date(self): self.date = self.cal.selection_get() self.top.destroy() def get_date(self): return self.date def quit(self): self.top.destroy()
def datePicker(): root = tk.Tk() def print_sel(): sel = cal.selection_get() print(sel) #cal.see(datetime.date(year=2016, month=2, day=5)) root.destroy() return sel top = tk.Toplevel(root) import datetime today = datetime.date.today() mindate = datetime.date(year=2018, month=1, day=21) maxdate = today + datetime.timedelta(days=1) #print(mindate, maxdate) print(today.year) print(today.month) print(today.day) cal = Calendar(top, font="Arial 14", selectmode='day', locale='en_US', mindate=mindate, maxdate=maxdate, disabledforeground='red', cursor="hand1", year=today.year, month=today.month, day=today.day) cal.pack(fill="both", expand=True) ttk.Button(top, text="ok", command=print_sel).pack() root.mainloop()
def dob_picker(self): today = datetime.date.today() self.dob_date_picker = Tk() self.dob_date_picker.iconbitmap('giocomo_lab.ico') self.dob_date_picker.wm_title("Select Date") mindate = datetime.date(year=2015, month=1, day=1) maxdate = today + datetime.timedelta(days=1) self.cal_dob = Calendar(self.dob_date_picker, font="Arial 14", selectmode='day', locale='en_US', mindate=mindate, maxdate=maxdate, background='darkblue', foreground='white', borderwidth=2, cursor="hand1", year=2019, month=2, day=5) self.cal_dob.grid(row=1, pady=40, padx=50, column=1, sticky="W") self.dob_button = Button(self.dob_date_picker, text="Done", command=self.dob_selected, background="#d3d3d3") self.dob_button.grid(row=2, column=1, padx=220, pady=(0, 30), sticky='sW')
class HebrewSchedulerGUI(object): def __init__(self, input_handler): self.input_handler = input_handler self.root = tk.Tk(className=' HebrewScheduler') s = ttk.Style(self.root) s.theme_use('clam') tk.Label(self.root, text="Summary").grid(row=0) tk.Label(self.root, text="Description").grid(row=1) tk.Label(self.root, text="Location").grid(row=2) tk.Label(self.root, text="Number of years").grid(row=3) tk.Label(self.root, text="Color").grid(row=4) ttk.Button(self.root, text='Calendar', command=self.open_calendar).grid(row=5) self.summary = tk.Entry(self.root) self.desc = tk.Entry(self.root) self.loc = tk.Entry(self.root) self.num_of_years = tk.Entry(self.root) self.color_listbox = tk.Listbox(self.root, selectmode=tk.SINGLE, height=len(configuration.COLOR_CODES)) for i, (c_n, c) in enumerate( zip(configuration.COLOR_CODES_LEGEND.keys(), configuration.COLOR_CODES)): self.color_listbox.insert("end", c_n) self.color_listbox.itemconfig(i, {'bg': c}) self.summary.grid(row=0, column=1) self.desc.grid(row=1, column=1) self.loc.grid(row=2, column=1) self.num_of_years.grid(row=3, column=1) self.color_listbox.grid(row=4, column=1) self.top = None self.cal = None def open_calendar(self): self.top = tk.Toplevel(self.root) ttk.Label(self.top, text='Choose date').pack(padx=10, pady=10) self.cal = Calendar(self.top, font="Arial 14", selectmode='day', cursor="hand1") self.cal.pack(fill="both", expand=True) ttk.Button(self.top, text="ok", command=self.process_inputs).pack() def process_inputs(self): picked_vals = (self.cal.selection_get(), self.summary.get(), self.desc.get(), self.loc.get(), configuration.COLOR_CODES_LEGEND[ self.color_listbox.selection_get()], int(self.num_of_years.get())) print(picked_vals) self.top.destroy() self.root.destroy() self.input_handler(*picked_vals) def run_gui(self): self.root.mainloop()
def example1(): def print_sel(): print(cal.selection_get()) cal.see(datetime.date(year=2016, month=2, day=5)) top = tk.Toplevel(root) import datetime today = datetime.date.today() mindate = datetime.date(year=2018, month=1, day=21) maxdate = today + datetime.timedelta(days=5) print(mindate, maxdate) cal = Calendar(top, font="Arial 14", selectmode='day', locale='en_US', mindate=mindate, maxdate=maxdate, disabledforeground='red', cursor="hand1", year=2018, month=2, day=5) cal.pack(fill="both", expand=True) ttk.Button(top, text="ok", command=print_sel).pack()
def __init__(self, parent_view): super().__init__(parent_view) self.parent = parent_view self.title('AU/krank Eintragen') startdatum_label = tk.Label(self, text="von") self.startdatum_input = Calendar(self, date_pattern='MM/dd/yyyy') enddatum_label = tk.Label(self, text="bis") self.enddatum_input = Calendar(self, date_pattern='MM/dd/yyyy') self.save_button = tk.Button(self, text="Daten speichern") self.exit_button = tk.Button(self, text="Abbrechen", command=self.destroy) self.saveandnew_button = tk.Button(self, text="Daten speichern und neu") # ins Fenster packen startdatum_label.grid(row=1, column=0, sticky=tk.NW) self.startdatum_input.grid(row=1, column=1, columnspan=2, sticky=tk.NW) enddatum_label.grid(row=1, column=3, sticky=tk.NW) self.enddatum_input.grid(row=1, column=4, sticky=tk.NW) self.save_button.grid(row=15, column=0, sticky=tk.NW) self.exit_button.grid(row=15, column=1, sticky=tk.NW) self.saveandnew_button.grid(row=15, column=2, sticky=tk.NW)
def dateFunction(self): # Create Object rootNew = Tk() # Set geometry rootNew.geometry("300x300") rootNew.title("Calendar") # Add Calender cal = Calendar( rootNew, foreground="black", selectforeground="red", selectmode="day", year=2021, month=5, day=13, ) cal.pack(pady=20) def grad_date(): self.defaultDob.set(str(cal.get_date())) rootNew.destroy() # Add Button and Label Button(rootNew, text="Get Date", command=grad_date).pack(pady=20) date = Label(rootNew, text="") date.pack(pady=20)
class CusCalendar(): def __init__(self, root): self.top = tk.Toplevel(root) self.cal = Calendar(self.top, font="Arial 14", selectmode='day', cursor="hand1", year=2018, month=2, day=5) self.cal.pack(fill="both", expand=True) ttk.Button(self.top, width="14", text="선택", command=self.select_date).pack(side="left", padx=5, pady=5) ttk.Button(self.top, width="14", text="창닫기", command=self.destory_win).pack(side="left", padx=5, pady=5) # self.date = '' # self.top.grab_set() def select_date(self): self.date = self.cal.selection_get() self.top.destroy() def destory_win(self): self.date = '' self.top.destroy() pass
def date(): def print_sel(): global cal, DATE DATE = calen.selection_get() if DATE != '': cal = Label(root, text=DATE, bg='red', fg='black') cal.place(x=300, y=280) top.destroy() top = tk.Toplevel(root) top.geometry('300x300+650+400') import datetime today = datetime.date.today() #mindate = today mindate = datetime.date(year=2018, month=1, day=1) #maxdate = today + datetime.timedelta(days=5) maxdate = datetime.date(year=2030, month=1, day=1) #print(mindate, maxdate) calen = Calendar(top, font="Arial 10", selectmode='day', locale='en_US', mindate=mindate, maxdate=maxdate, disabledforeground='red', cursor="hand1", year=2020, month=1, day=1) calen.pack(fill="both", expand=True) ttk.Button(top, text="ok", command=print_sel).pack()
def example1(): def print_sel(): print(cal.selection_get()) var.append(cal.selection_get()) # cal.see(datetime.date(year=2016, month=2, day=5)) var1 = str(var[0]) l4.config(text=var1) top.destroy() top = Toplevel(donate) import datetime today = datetime.date.today() mindate = today maxdate = today + datetime.timedelta(days=5) cal = Calendar(top, font="Arial 14", selectmode='day', locale='en_US', mindate=mindate, maxdate=maxdate, disabledforeground='red', cursor="hand1", year=2018, month=2, day=5) cal.pack(fill="both", expand=True) ttk.Button(top, text="ok", command=print_sel).pack()
def pop_up_cal(): # make a window pop up with a calander, return to the sender the date picked win = tk.Toplevel() win.wm_title('Choose Calander') start_date_cal = Calendar(win) start_date_cal.grid()
def datepick(ob): if str(ob.var2.get()) == '0': ob.dateLabel.configure(text='') if str(ob.var2.get()) == '1': def print_sel(): ob.requestdate = str(cal.selection_get()) ob.dateLabel.configure(text=ob.requestdate) root.destroy() root = Tk() root.title("Calendar") #s = ttk.Style(root) #s.theme_use('clam') top = tk.Toplevel(root) cal = Calendar(top, font="Arial 14", selectmode='day', cursor="hand1", year=2019, month=4, day=15) cal.pack(fill="both", expand=True) ttk.Button(top, text="ok", command=print_sel).pack() root.mainloop()
def __init__(self, parent, controller): Frame.__init__(self, parent) self.controller = controller self.parent = parent global back_img, create_img, buttonbg back_img = ImageTk.PhotoImage(Image.open("assets/back.png")) back_btn = Button(self, text="Back to Menu", image=back_img, anchor="center", compound="left", bd=0, padx=-10, command=lambda: controller.show_frame("Homescreen")) back_btn.pack(pady=(0, 20)) image = Label(self, image=diary_img, text="Diary", compound="left", padx=10) image.pack() diary_help = Label( self, text= "Use the diary to store your thoughts or narrate how your day went.\nDon't worry, Andy is great at keeping secrets ;]" ) diary_help.pack(pady=10) create_img = ImageTk.PhotoImage( Image.open("assets/create.png").resize((30, 30), Image.ANTIALIAS)) create_btn = Button( self, text="Create new entry", image=create_img, anchor="center", compound="left", bd=0, command=lambda: controller.show_frame("DiaryCreateFrame")) create_btn.pack(pady=(10, 20)) cal = Calendar(self, firstweekday="sunday", showweeknumbers=False, borderwidth=0, date_pattern="yyyy-mm-dd") cal.pack(padx=20, pady=10) buttonbg = ImageTk.PhotoImage( Image.open("assets/create.png").resize((30, 30), Image.ANTIALIAS)) print_btn = Button(self, cursor="dotbox", text="Check Entries for the selected date", image=buttonbg, bd=0, command=lambda: self.check_records(cal.get_date())) print_btn.pack(padx=15, pady=15)
def __init__(self): self.day_one = "5/8/16" #index 881 of processed data self.date_one = datetime.datetime(day=5, month=8, year=2016) self.states = {"testing": False, "tested": False} #state of the gui self.root = tk.Tk() self.height = 500 self.width = 1000 self.canvas = tk.Canvas(self.root, height=self.height, width=self.width, bg="#263d42") self.canvas.pack() self.frame = tk.Frame(self.root, bg="#3e646c") self.frame.place(width=self.width * 0.6, height=self.height, y=0, x=0) self.btns = {} self.labels = {} self.test_list = [] self.btns["run"] = Button(self.frame, text="Play Trading Period", fg="#263d42") self.btns["run"].grid(row=0) self.btns["run"].bind("<Button-1>", self.run_test) self.btns["graph"] = Button(self.frame, text="Create Graph", fg="#263d42") self.btns["graph"].grid(row=0, column=1) self.btns["graph"].bind("<Button-1>", self.update_chart) self.btns["alloc"] = Button(self.frame, text="Show Allocations", fg="#263d42") self.btns["alloc"].grid(row=0, column=2) self.btns["alloc"].bind("<Button-1>", self.show_allocations) self.btns["roi"] = Button(self.frame, text="Show ROI", fg="#263d42") self.btns["roi"].grid(row=0, column=3) self.btns["roi"].bind("<Button-1>", self.show_roi) self.labels["run"] = Label(self.frame, text="Not Running") self.cal = Calendar(self.canvas, font="Arial 14", selectmode='day', cursor="hand1", year=2018, month=2, day=5) self.cal.pack(fill="both", expand=True) self.canvas.create_window((self.width * 0.6, 0), window=self.cal, anchor='nw')
def bind(self, *args): Calendar.bind(self, *args) header = self._header_month.master.master header.bind(*args) for widget in header.children.values(): widget.bind(*args) for w in widget.children.values(): w.bind(*args)