def body(self, master): kwargs = {} if self.month != None: kwargs['month'] = self.month if self.year != None: kwargs['year'] = self.year self.calendar = ttkcalendar.Calendar(master, **kwargs) self.calendar.pack()
def popup_calendar(self, widget): toplevel = tk.Toplevel() toplevel.resizable(width='false', height='false') toplevel.wm_attributes('-topmost', 1) ttkcal = ttkcalendar.Calendar(toplevel, firstweekday=calendar.MONDAY) ttkcal.pack() def select_date(widget): date = ttkcal.selection if date: widget.delete(0, 'end') widget.insert('end', '{}.{}.{}'.format(str(date.day).zfill(2), str(date.month).zfill(2), date.year)) toplevel.destroy() ok_btn = ttk.Button(toplevel, text='seç', command=lambda: select_date(widget)) ok_btn.pack()
def body(self, master): self.calendar = ttkcalendar.Calendar(master) self.calendar.pack()
def body(self, root): self.calendar = ttkcalendar.Calendar(root) self.calendar.pack()
except xmlrpclib.ProtocolError, errcode: errorWindow("Remote Server is Busy or Down.. Try again later") except xmlrpclib.ResponseError, errcode: errorWindow("Invalid Response from the Remote server") except socket.error as err: errorWindow("Remote Server connection error") except AttributeError as err: if str(err).find("date"): errorWindow("Date Error... Please enter a Valid Date!!") else: errorWindow(str(err)) except Exception as err: errorWindow("Unknown Error:"+str(err)) # Creating Calender to enter the date for which the prediction has to be done cal = ttkcalendar.Calendar(diskUIRoot) # Initializing the Widget for the dropdown var = StringVar(modelOptionFrame) optionTuple=getModelNames() optionMenuWidget = apply(OptionMenu, (modelOptionFrame, var) + optionTuple) optionMenuWidget.pack(side=TOP) cal.pack() modelOptionFrame.pack() # Creating the Start button to initiate prediction startButton= tk.Button(diskUIRoot,text="Start",command=runAnalysis) startButton.pack() diskUIRoot.mainloop()
def __init__(self, master): self.calendar = ttkcalendar.Calendar(master) self.calendar.pack()
def body(self,m): self.calendar = ttkcalendar.Calendar(m) self.calendar.pack()
def ok_clicked(): result = calendar.selection #獲取選取日期的資料,此時資料型態是datetime result = str(result) #將資料型態轉換成字串 result = result[0:10] #擷取自前面幾個所需字元 會顯示出 yyyy-mm-dd result = result.replace('-', '/') #將字元 - 轉換成 / print ' ' in result #判斷是否有某字元存在於字串 print type(result) print result root = Tkinter.Tk() title = root.title('Calendar Test') calendar = ttkcalendar.Calendar(root) #宣告calendar物件 calendar.pack() button = Tkinter.Button(root, text='ok', command=ok_clicked) button.pack() root.mainloop() """ class CalendarDialog(tkSimpleDialog.Dialog): #Dialog box that displays a calendar and returns the selected date def body(self, master): self.calendar = ttkcalendar.Calendar(master) self.calendar.pack() def apply(self): self.result = self.calendar.selection
def __init__(self, master): self.Calendar = ttkcalendar.Calendar(master) self.Calendar.pack(expand=1, fill='both')