Ejemplo n.º 1
0
class DateWidget(tk.Frame):
    def __init__(self, master, **options):
        tk.Frame.__init__(self, master, **options)
        self.makeWidgets()

    def makeWidgets(self):
        if (date.today().month - 1) < 1:
            fromdate = date(date.today().year - 1, month=12, day=1)
        else:
            fromdate = date.today().replace(month=date.today().month - 1, day=1)

        self.__from = DatePicker(self, date=fromdate)
        self.__to = DatePicker(self)
        tk.Label(self, text='From: ').pack(side=tk.LEFT)
        self.__from.pack(side=tk.LEFT, padx=5, pady=5)
        tk.Label(self, text='To: ').pack(side=tk.LEFT)
        self.__to.pack(side=tk.LEFT, padx=5, pady=5)

    @property
    def fromDate(self):
        return self.__from.date

    @property
    def toDate(self):
        return self.__to.date
Ejemplo n.º 2
0
    def makeWidgets(self):
        if (date.today().month - 1) < 1:
            fromdate = date(date.today().year - 1, month=12, day=1)
        else:
            fromdate = date.today().replace(month=date.today().month - 1, day=1)

        self.__from = DatePicker(self, date=fromdate)
        self.__to = DatePicker(self)
        tk.Label(self, text='From: ').pack(side=tk.LEFT)
        self.__from.pack(side=tk.LEFT, padx=5, pady=5)
        tk.Label(self, text='To: ').pack(side=tk.LEFT)
        self.__to.pack(side=tk.LEFT, padx=5, pady=5)