예제 #1
0
    def dateentry():
        def app_sel():
            a = (cal.get_date())
            year = a.strftime("%Y")
            month = a.strftime("%m")
            date = a.strftime("%d")
            Dt = datetime.datetime(int(year), int(month), int(date), 0, 0, 0)
            store.append(Dt)
            insert_data(task, 1, Dt)

            update_listbox()

            pos = 0
            ln_tks = len(tasks)
            while pos is not ln_tks:
                color_sel(pos)
                pos += 1
            top.destroy()

        top = Toplevel(root)
        top.maxsize(200, 140)
        top.minsize(200, 140)
        top.title("Date-Entry")

        ttk.Label(top, text='Choose date').pack(padx=10, pady=10)
        cal = DateEntry(top,
                        font="Arial 14",
                        selectmode='day',
                        locale='en_US',
                        cursor="hand2")
        cal.pack(fill="both", expand=True)
        ttk.Button(top, text="OK", command=app_sel).pack()
        ttk.Button(top, text="EXIT", command=top.destroy).pack()
예제 #2
0
def pick_specific_day():
    def run_graph():
        local_vales = []
        print(type(cal.get_date()))
        datetime_object = cal.get_date()
        if(datetime_object >= epoch_values[0].date() and datetime_object <= epoch_values[len(epoch_values) - 1].date()):
            print("Showing: " + str(datetime_object))
            for i in epoch_values:
                if(i.date() == datetime_object):
                    local_vales.append(i)
            show_graph(local_vales)
        else:
            print("That date isn't possible, try again!")

    top = tk.Toplevel(root)

    message = "Select a day from, " + \
        str(epoch_values[0].date()) + " to " + \
        str(epoch_values[len(epoch_values)-1].date())

    ttk.Label(top, text=message).pack(padx=10, pady=10)

    cal = DateEntry(top, width=12, background='darkblue',
                    foreground='white', borderwidth=2)
    cal.set_date(epoch_values[0])
    cal.pack(padx=10, pady=10)

    ttk.Button(top, text="Show graph", command=run_graph).pack()
def dateentry_view():
    def print_sel():
        val_entry_date = (cal.get_date())
        val_entry_date1 = (cal1.get_date())
        totalDays = definitions(val_entry_date, val_entry_date1)
        result = tk.Label(top, text='NUMBER OF DAYS :')
        result.pack(padx=10, pady=10)
        result["text"] = 'NUMBER OF DAYS :' + str(totalDays)
        print("Total number of days %s " % totalDays)

    top = tk.Toplevel(root)

    tk.Label(top, text='Choose date').pack(padx=10, pady=10)
    cal = DateEntry(top,
                    width=12,
                    background='darkblue',
                    foreground='white',
                    borderwidth=2,
                    dateformat=3)
    cal1 = DateEntry(top,
                     width=12,
                     background='darkblue',
                     foreground='white',
                     borderwidth=2,
                     dateformat=3)
    cal.pack(padx=10, pady=10)
    cal1.pack(padx=12, pady=10)
    tk.Button(top, text="ok", command=print_sel).pack()
예제 #4
0
    def test_dateentry_get_set(self):
        widget = DateEntry(self.window,
                           width=12,
                           background='darkblue',
                           foreground='white',
                           borderwidth=2,
                           font='Arial 9')
        widget.pack()
        self.window.update()

        keys = [
            'exportselection', 'invalidcommand', 'justify', 'show', 'cursor',
            'style', 'state', 'takefocus', 'textvariable', 'validate',
            'validatecommand', 'width', 'xscrollcommand'
        ]
        keys.extend(widget._calendar.keys())
        self.assertEqual(sorted(list(set(keys))), sorted(widget.keys()))

        self.assertEqual(widget["background"], 'darkblue')
        self.assertEqual(widget.cget("width"), 12)

        widget["borderwidth"] = 5
        self.window.update()
        self.assertEqual(widget["borderwidth"], 5)

        widget.config(font="Arial 20 bold")
        self.window.update()
        self.assertEqual(widget["font"], "Arial 20 bold")

        widget.config(style="my.TEntry")
        self.window.update()
        self.assertEqual(widget["style"], "my.TEntry")
예제 #5
0
def determine_person(frame, backframe, nextframe2, details, exists):
    """
    Gets user details. Depending on if user exists, directs to different frames.
    :param frame: current frame
    :param backframe: previous frame (main menu)
    :param nextframe2: next frame if user exists
    :param details: empty dictionary to store user details
    :param exists: True if user exists
    :type exists: boolean
    """

    tk.Label(frame, text="Please enter your details and press submit").pack()

    tk.Label(frame, text="Are you a patient?").pack()
    var = tk.IntVar()
    tk.Checkbutton(frame, text="Yes", variable=var).pack()

    tk.Label(frame, text="What is your postcode?").pack()
    inputpostcode = tk.Entry(frame)
    inputpostcode.pack()

    tk.Label(frame, text="What is your name?").pack()
    inputname = tk.Entry(frame)
    inputname.pack()

    tk.Label(frame, text="What is your date of birth?").pack()
    cal = DateEntry(frame,
                    locale="en_UK",
                    date_pattern="dd/mm/yyyy",
                    showweeknumbers=False,
                    font="Arial 10",
                    width=12,
                    background='grey',
                    foreground='white',
                    borderwidth=2,
                    maxdate=date.today())
    cal.pack(padx=10, pady=10)
    if exists:
        tk.Button(frame,
                  text="Submit",
                  command=lambda: [
                      get_details(details, inputname.get(), cal.get_date(),
                                  inputpostcode.get(), var.get()),
                      raise_frame(nextframe2)
                  ]).pack()
    else:
        tk.Button(frame,
                  text="Submit",
                  command=lambda: [
                      add_new_person_to_db(
                          get_details(details, inputname.get(), cal.get_date(),
                                      inputpostcode.get(), var.get())),
                      raise_frame(nextframe2)
                  ]).pack()

    tk.Button(frame,
              text="Go back to main menu",
              command=lambda: raise_frame(backframe)).pack()
    inputpostcode.delete(0, constants.END)
    inputname.delete(0, constants.END)
    def selectIndividualDate():
        def confirmIndividualDate():
            global dateEntered
            dateEntered = cal.get_date()
            #now I add the user/date pair to the graph and remove the window
            global graph
            graph.addUserDate(personEntered, dateEntered)
            destroyAvailables()
            top.destroy()
            setStopDatesButton()

        top = tk.Toplevel(root)
        ttk.Label(top, text='Choose a date').pack(padx=10, pady=10)
        global begDate
        global endDate
        mindate = begDate

        maxdate = endDate
        cal = DateEntry(top,
                        width=12,
                        background='darkblue',
                        foreground='white',
                        borderwidth=2,
                        mindate=mindate,
                        maxdate=maxdate)
        cal.pack(padx=10, pady=10)
        conf = ttk.Button(top, text="confirm", command=confirmIndividualDate)
        conf.pack()
예제 #7
0
class CalendarWindow(object):
    def __init__(self, master):
        self.before = int(datetime(2020, 9, 1).timestamp())
        self.after = int(datetime(2020, 8, 1).timestamp())

        top = self.top = Toplevel(root)
        self.label = Label(top, text='Choose date').pack(padx=10, pady=10)
        self.start_cal = DateEntry(top,
                                   width=12,
                                   background='darkblue',
                                   foreground='white',
                                   borderwidth=2)
        self.start_cal.pack(padx=10, pady=10)
        self.end_cal = DateEntry(top,
                                 width=12,
                                 background='darkblue',
                                 foreground='white',
                                 borderwidth=2)
        self.end_cal.pack(padx=10, pady=10)
        self.b = Button(top, text='Ok', command=self.cleanup)
        self.b.pack()

    # Function to deal with weird difference between date and datetime objects
    def cleanup(self):
        def to_epoch(d: datetime.date):
            return calendar.timegm(d.timetuple())

        # Set before and after attributes from calendar dates
        self.before = to_epoch(self.start_cal.get_date())
        self.after = to_epoch(self.end_cal.get_date())
        self.top.destroy()
def calen():
    def print_date():
        print(my_name)
        global meetingdate
        meetingdate = cal.get_date()
        if (available == 1):
            print("yes")
            db.execute(
                "INSERT INTO MEETING (USER1,USER2,TITLE,MESSAGE,DURATION,DATE1,TIME_FROM,TIME_TO) VALUES(?,?,?,?,?,?,?,?)",
                (my_name, name, meetingtitle.get(), meetingmsg.get(),
                 durn.get(), meetingdate, "09:00:00", "17:00:00"))
            db.commit()
            return
        else:
            checkAvailabilty()

    top = Toplevel(msg)
    Label(top, text='Choose date').pack(padx=10, pady=10)

    cal = DateEntry(top,
                    width=12,
                    background='darkblue',
                    foreground='white',
                    borderwidth=2)
    cal.pack(padx=10, pady=10)

    Button(top, text="Ok", command=print_date).pack()
예제 #9
0
    def test_dateentry_get_set(self):
        widget = DateEntry(self.window, width=12, background='darkblue',
                           locale='en_US', foreground='white', borderwidth=2,
                           font='Arial 9', year=2019, month=7, day=3)
        widget.pack()
        self.window.update()

        keys = ['exportselection',
                'invalidcommand',
                'justify',
                'show',
                'cursor',
                'calendar_cursor',
                'style',
                'state',
                'takefocus',
                'textvariable',
                'validate',
                'validatecommand',
                'width',
                'xscrollcommand']
        keys.extend(widget._calendar.keys())
        self.assertEqual(sorted(list(set(keys))), sorted(widget.keys()))

        self.assertEqual(widget["background"], 'darkblue')
        self.assertEqual(widget.cget("width"), 12)

        widget["borderwidth"] = 5
        self.window.update()
        self.assertEqual(widget["borderwidth"], 5)

        widget.configure({'foreground': 'cyan', 'font': 'FreeMono 10',
                          'background': 'green'},
                         background="blue", borderwidth=4,
                         font="Arial 20 bold", justify='center')
        self.window.update()
        self.assertEqual(widget["foreground"], "cyan")
        self.assertEqual(widget["background"], "blue")
        self.assertEqual(widget["borderwidth"], 4)
        self.assertEqual(widget["font"], "Arial 20 bold")
        self.assertEqual(widget["justify"], "center")

        widget.config(font="Arial 20 bold")
        self.window.update()
        self.assertEqual(widget["font"], "Arial 20 bold")

        widget.config(style="my.TEntry")
        self.window.update()
        self.assertEqual(widget["style"], "my.TEntry")

        style = ttk.Style(self.window)
        style.theme_use('clam')

        self.assertEqual(widget["locale"], "en_US")
        self.assertEqual(widget.get(), '7/3/19')
        widget.config(locale="fr_FR")
        self.window.update()
        self.assertEqual(widget["locale"], "fr_FR")
        self.assertEqual(widget.get(), '03/07/2019')
예제 #10
0
def example3():
    top = tk.Toplevel(root)

    ttk.Label(top, text='Choose date').pack(padx=10, pady=10)

    cal = DateEntry(top, width=12, background='darkblue',
                    foreground='white', borderwidth=2, year=2010)
    cal.pack(padx=10, pady=10)
def getInitialDateRange():
    def setBegDate():
        global begDate
        begDate = cal.get_date()
        top.destroy()
        getInitialDateRange()

    def setEndDate():
        global endDate
        endDate = cal.get_date()
        #destroying current window
        top.destroy()
        #setup for the rest
        for widget in root.winfo_children():
            widget.destroy()
        #now we can create the graph
        global begDate
        global graph
        graph = DateGraph(begDate, endDate)
        #setting up person selection
        setupPersonSelection()

    top = tk.Toplevel(root)
    if (begDate == None):
        Lab = ttk.Label(top,
                        text='Choose the first possible date for your event!')
        Lab.pack()
    else:
        Lab = ttk.Label(top,
                        text='Choose the last possible date for your event!')
        Lab.pack()

    if (begDate == None):
        mindate = datetime.date.today()
    else:
        mindate = begDate
    #exception handling

    try:
        maxdate = datetime.date(mindate.year + 4, mindate.month, mindate.day)
    except:
        #then we were on a leap year on last day of Feb
        maxdate = datetime.date(mindate.year + 4, mindate.month + 1, 1)

    cal = DateEntry(top,
                    width=12,
                    background='darkblue',
                    foreground='white',
                    borderwidth=2,
                    mindate=mindate,
                    maxdate=maxdate)
    cal.pack(padx=10, pady=10)
    if (begDate == None):
        con = ttk.Button(top, text="confirm", command=setBegDate)
        con.pack()
    else:
        con = ttk.Button(top, text="confirm", command=setEndDate)
        con.pack()
예제 #12
0
def example3():
    top = tk.Toplevel(root)

    ttk.Label(top, text='Choose date').pack(padx=10, pady=10)

    cal = DateEntry(top, width=12, background='darkblue',
                    foreground='white', borderwidth=2, year=2021,
                    locale='ru_RU', date_pattern='dd.MM.YYYY')
    cal.pack(padx=10, pady=10)
예제 #13
0
class StatisticFrame(Frame):
    def __init__(self):
        Frame.__init__(self)
        self.pack()

        # Db
        db = Db()

        now = datetime.now()

        # Station selectbox
        stationOptions = {}
        for station in db.getStations():
            stationOptions[station.name] = station.id
        self.stationSelect = Select(self, 'Station:', stationOptions)
        self.stationSelect.setEvent(self.updateStatistic)

        # Type selectbox
        self.statisticTypeSelect = Select(self, 'Type:', {
            'Day': 'day',
            'Month': 'month',
            'Year': 'year'
        })
        self.statisticTypeSelect.setEvent(self.updateStatistic)

        # Date from calendar
        self.dateFromSelect = DateEntry(self,
                                        selectmode='day',
                                        date_pattern='dd.mm.y')
        self.dateFromSelect.set_date(self.firstDayOfMonth(now))
        self.dateFromSelect.bind("<<DateEntrySelected>>", self.updateStatistic)
        self.dateFromSelect.pack()

        # Date to calendar
        self.dateToSelect = DateEntry(self,
                                      selectmode='day',
                                      date_pattern='dd.mm.y')
        self.dateToSelect.set_date(self.lastDayOfMonth(now))
        self.dateToSelect.bind("<<DateEntrySelected>>", self.updateStatistic)
        self.dateToSelect.pack()

        # Update statistic
        self.updateStatistic()

    def updateStatistic(self, *args):
        StatisticPrint(self, self.stationSelect.get(),
                       self.dateFromSelect.get_date(),
                       self.dateToSelect.get_date(),
                       self.statisticTypeSelect.get())

    def firstDayOfMonth(self, d):
        return d.replace(day=1, hour=0, minute=0, second=0, microsecond=0)

    def lastDayOfMonth(self, d):
        if d.month == 12:
            return d.replace(day=31)
        return d.replace(month=d.month + 1, day=1) - timedelta(days=1)
예제 #14
0
 def cal():
     top = Toplevel(root)
     Label(top, text='Choose date').pack(padx=10, pady=10)
     date = DateEntry(top,
                      width=12,
                      background='black',
                      foreground='white',
                      borderwidth=2,
                      year=2010)
     date.pack(padx=10, pady=10)
예제 #15
0
 def test_dateentry_drop_down(self):
     """Check whether drop down opens on click."""
     widget = DateEntry(self.window)
     widget.pack()
     self.window.update()
     w = widget.winfo_width()
     h = widget.winfo_height()
     widget._on_b1_press(TestEvent(widget=widget, x=w - 10, y=h // 2))
     self.window.update()
     self.assertTrue(widget._top_cal.winfo_ismapped())
예제 #16
0
 def test_dateentry_init(self):
     widget = DateEntry(self.window, width=12, background='darkblue',
                        foreground='white', borderwidth=2)
     widget.pack()
     self.window.update()
     widget.destroy()
     widget = DateEntry(self.window, year=2012)
     widget.pack()
     self.window.update()
     widget.destroy()
예제 #17
0
def dateentry_view():
    def print_sel():
        print(cal.get_date())
    top = tk.Toplevel(root)

    ttk.Label(top, text='Choose date').pack(padx=10, pady=10)
    cal = DateEntry(top, width=12, background='darkblue',
                    foreground='white', borderwidth=2)
    cal.pack(padx=10, pady=10)
    ttk.Button(top, text="ok", command=print_sel).pack()
예제 #18
0
파일: Backup.py 프로젝트: fgeertsma/GUI-DSS
    def __init__(self, master=None):
        tk.Frame.__init__(self, master)  # ADDED parent argument.
        self.master.title("Backup Window")

        Instruct_Label = tk.Label(self, text='Choose date')


        Leave_Button = tk.Button(self, text="Quit",
                          command=lambda:          self.close())


        Backup_Button = tk.Button(self, text="Backup",
                                  command=lambda: self.backup(start_date=str(Start_Date_Calander.get()), start_time=(Start_Time_Slider.get()),
                                                               end_date=(End_Date_Calander.get()), end_time=(End_Time_Slider.get())))

#----------------------------Start-Date--------------------------------------------------------------------------------

        Start_Frame = tk.Frame(self, bg="DarkBlue", borderwidth=2)

        Start_Label = tk.Label(Start_Frame, text="Select Start Date/Time")

        Start_Date_Calander = DateEntry(Start_Frame, width=12, background='darkblue',
                        foreground='white', borderwidth=2, date_pattern='y-mm-dd')

        Start_Time_Slider = tk.Scale(Start_Frame, from_=0, to=23, orient=tk.HORIZONTAL)

#-----------------------------End-Date----------------------------------------------------------------------------------

        End_Frame = tk.Frame(self, bg="DarkRed", borderwidth=2)

        End_Label = tk.Label(End_Frame, text="Select End Date/Time")

        End_Date_Calander = DateEntry(End_Frame, width=12,       background='darkred',
                                            borderwidth=2,  foreground='white',
                                                            date_pattern='y-mm-dd')

        End_Time_Slider = tk.Scale(End_Frame, from_=0, to=23, orient=tk.HORIZONTAL)

#----------------------------Packing------------------------------------------------------------------------------------

        Leave_Button.pack()

        Start_Frame.pack(side=tk.LEFT, anchor=tk.N)
        Start_Label.pack()
        Start_Date_Calander.pack(side=tk.BOTTOM)
        Start_Time_Slider.pack(side=tk.TOP)

        End_Frame.pack(side=tk.RIGHT, anchor=tk.N)
        End_Label.pack()
        End_Date_Calander.pack(side=tk.BOTTOM)
        End_Time_Slider.pack(side=tk.TOP)

        Instruct_Label.pack(side=tk.TOP, anchor=tk.N)
        Backup_Button.pack(anchor=tk.N)
 def _date_of_birth(self):
     """ Calendar popup """
     new_wins = tk.Toplevel()
     cal = DateEntry(new_wins,
                     width=15,
                     background="blue",
                     foreground="red",
                     borderwidth=3,
                     date_pattern='y-mm-dd')
     cal.pack(padx=10, pady=10)
     self.date_of_birth = cal.get_date()
예제 #20
0
class StatisticFrame(Frame):
    def __init__(self):
        Frame.__init__(self)
        self.pack()

        # Db
        db = Db()

        # Datetime now
        now = datetime.now()

        # Station selectbox
        stationOptions = {}
        for station in db.getStations():
            stationOptions[station.name] = station.id
        self.stationSelect = Select(self, 'Station:', stationOptions)
        self.stationSelect.setEvent(self.updateStatistic)

        # Type selectbox
        self.statisticTypeSelect = Select(self, 'Type:', {
            'Day': 'D',
            'Month': 'm',
            'Year': 'Y'
        })
        self.statisticTypeSelect.setEvent(self.updateStatistic)
        self.statisticTypeSelect.setValue('Day')

        # Date from calendar (7 Days before now)
        self.dateFromSelect = DateEntry(self,
                                        selectmode='day',
                                        date_pattern='dd.mm.y')
        self.dateFromSelect.set_date((now - timedelta(days=7)))
        self.dateFromSelect.bind("<<DateEntrySelected>>", self.updateStatistic)
        self.dateFromSelect.pack()

        # Date to calendar
        self.dateToSelect = DateEntry(self,
                                      selectmode='day',
                                      date_pattern='dd.mm.y')
        self.dateToSelect.set_date(now)
        self.dateToSelect.bind("<<DateEntrySelected>>", self.updateStatistic)
        self.dateToSelect.pack()

        # Statistic
        self.statistic = StatisticPrint(self, self.stationSelect.get(),
                                        self.dateFromSelect.get_date(),
                                        self.dateToSelect.get_date(),
                                        self.statisticTypeSelect.get())

    def updateStatistic(self, *args):
        self.statistic.set(self.stationSelect.get(),
                           self.dateFromSelect.get_date(),
                           self.dateToSelect.get_date(),
                           self.statisticTypeSelect.get())
def example2():
    def print_sel(e):
        print(cal.get_date())

    top = tk.Toplevel(root)

    ttk.Label(top, text='Choose date').pack(padx=10, pady=10)

    cal = DateEntry(top, width=12, background='darkblue',
                    foreground='white', borderwidth=2)
    cal.pack(padx=10, pady=10)
    cal.bind("<<DateEntrySelected>>", print_sel)
예제 #22
0
파일: gui.py 프로젝트: aladmit/ira-utils
class Gui:
    interval = 0.1  # Период обновления окна в секундах

    def __init__(self, run_callback: Callable, close_callback: Callable):
        self._root = tk.Tk()
        self._root.wm_title("YouTube статистика")

        label = tk.Label(width=40)
        label["text"] = "Дата отсечки:"
        label.pack()

        self._date = DateEntry(master=self._root, width=38)
        self._date.pack()

        label = tk.Label(width=40)
        label["text"] = "Google API ключ:"
        label.pack()

        self._api = tk.StringVar()
        tk.Entry(master=self._root, textvariable=self._api, width=40).pack()
        self._api.set(Settings.api_key())

        self._start_btn = tk.Button(master=self._root,
                                    text="Начать",
                                    command=lambda: run_callback(self))
        self._start_btn.pack()

        self._root.protocol("WM_DELETE_WINDOW", close_callback)

    def disable(self):
        self._start_btn.config(state=tk.DISABLED)

    @property
    def date(self) -> date:
        return self._date.get_date()

    @property
    def api(self) -> str:
        return self._api.get()

    @property
    def video(self):
        return self._video.get()

    async def run(self):
        # По образцу https://gist.github.com/Lucretiel/e7d9a50b7b1960a56a1c
        try:
            while True:
                self._root.update()
                await sleep(self.interval)
        except tk.TclError as e:
            if "application has been destroyed" not in e.args[0]:
                raise
예제 #23
0
def change_disp(main_user, duty):
    def go_back():
        root.destroy()
        windows_init.show_my_duties(main_user)

    def ok():
        date = e_date.get_date()
        select = list(t_lbox.curselection())
        if len(select) > 0 and curr_students:
            duty.s_id = curr_students[select[0]].id
        selected_s = curr_students[select[0]]
        duty.date = date
        db.update_duty_by_id(duty)
        go_back()

    def delete():
        db.delete_duty_by_id(duty.duty_id)
        go_back()

    root = tk.Tk()
    root.resizable(False, False)
    root.title("Изменение дежурства")
    screen_width = root.winfo_screenwidth() // 2 - 210
    screen_height = root.winfo_screenheight() // 2 - 135
    root.geometry('420x270+{}+{}'.format(screen_width, screen_height))

    db = DataBase()
    b_del = tk.Button(text="Удалить дежурство", command=delete)
    b_back = tk.Button(text="Назад", command=go_back)
    t_lbox = tk.Listbox(exportselection=0, width=40, height=10)

    global curr_students
    curr_students = db.get_dispatchers()
    if not curr_students:
        t_lbox.insert(tk.END, "Нет диспетчеров")
        curr_students = []
    else:
        for s in curr_students:
            t_lbox.insert(tk.END, s.name)

    b_ok = tk.Button(text="OK", command=ok)
    e_date = DateEntry(root,
                       width=12,
                       background='darkblue',
                       foreground='white',
                       borderwidth=2,
                       year=2019)
    e_date.pack(padx=10, pady=10)
    t_lbox.pack(side="top")
    b_ok.pack()
    b_del.pack()
    b_back.place(x=0, y=250, width=40, height=20)
    root.mainloop()
예제 #24
0
def add_duty(main_user):
    def go_back():
        root.destroy()
        windows_init.show_my_duties(main_user)

    def ok():
        date = e_date.get_date()
        select = list(t_lbox.curselection())
        if len(select) < 1 or not curr_students:
            mb.showerror("Ошибка", "Выберите диспетчера!")
            return
        if str(datetime.datetime.now()).split()[0] > str(date):
            mb.showerror("Ошибка", "Невозможно запланировать дежурство в прошлом!")
            return
        selected_s = curr_students[select[0]]
        duty = Duty(("", "", "", ""))
        duty.date = date
        duty.s_id = selected_s.id
        db.insert_duty(duty)
        go_back()

    root = tk.Tk()
    root.resizable(False, False)
    root.title("Добавление дежурства")
    screen_width = root.winfo_screenwidth() // 2 - 210
    screen_height = root.winfo_screenheight() // 2 - 125
    root.geometry('420x250+{}+{}'.format(screen_width, screen_height))

    db = DataBase()

    b_back = tk.Button(text="Назад", command=go_back)
    t_lbox = tk.Listbox(exportselection=0, width=40, height=10)

    global curr_students
    curr_students = db.get_dispatchers()
    if not curr_students:
        t_lbox.insert(tk.END, "Нет диспетчеров")
        curr_students = []
    else:
        for s in curr_students:
            t_lbox.insert(tk.END, s.name)

    b_ok = tk.Button(text="OK", command=ok)
    e_date = DateEntry(root, width=12, background='darkblue',
                       foreground='white', borderwidth=2, year=2019)

    e_date.pack(padx=10, pady=10)
    t_lbox.pack(side="top")
    b_ok.pack()
    b_back.place(x=0, y=230, width=40, height=20)

    root.mainloop()
예제 #25
0
파일: Draw.py 프로젝트: wektor1/AWD
 def example2(self):
     global top
     top = Toplevel(root)
     ttk.Label(top, text='Choose date').pack(padx=10, pady=10)
     global cal2
     cal2 = DateEntry(top,
                      width=12,
                      background='darkblue',
                      foreground='white',
                      borderwidth=2)
     cal2.pack(padx=10, pady=10)
     closeButton4 = Button(top, command=self.quit2, text="Ok")
     closeButton4.pack(padx=5, pady=5)
예제 #26
0
    def test_dateentry_allow_empty(self):
        widget = DateEntry(self.window, allow_empty=True)
        widget.pack()
        self.window.update()

        self.assertTrue(widget._allow_empty)
        self.assertEqual(widget.get(), '')  # should start with no value
        widget.focus_set()
        self.window.focus_set()
        self.assertEqual(widget.get(), '')  # should not populate with a value
        
        self.assertRaises(IndexError, widget.get_date)
        self.assertRaises(ValueError, widget.set_date, '')
예제 #27
0
def dateentry_view():
    def print_sel():
        print(cal.get_date())

    top = Toplevel(root)
    ttk.Label(top, text="choose").pack()
    cal = DateEntry(top,
                    width=12,
                    background="darkblue",
                    foreground="white",
                    borderwidth=2)
    cal.pack()
    ttk.Button(top, text="ok", command=print_sel).pack()
예제 #28
0
 def test_dateentry_init(self):
     widget = DateEntry(self.window, width=12, background='darkblue',
                        foreground='white', borderwidth=2, justify='center',
                        style='my.DateEntry')
     widget.pack()
     self.window.update()
     widget.destroy()
     widget = DateEntry(self.window, year=2012)
     widget.pack()
     self.window.update()
     widget.destroy()
     widget = DateEntry(self.window, year=2012, day=32)
     self.window.update()
     self.assertEqual(widget.get_date(), date.today())
예제 #29
0
 def __init__(self, master=None, **kwargs):
     ttk.Frame.__init__(self, master, **kwargs)
     master.title(config.APP_TITLE)
     master.geometry("850x650+300+200")
     cal = DateEntry(self, **config.date_entry_cnf)
     cal.pack(padx=10, pady=10)
     text = tk.Label(
         self,
         text="Aplikacja dla zarzadzania magazynem",
         fg="darkblue",
         font="Helvetica 16 bold italic",
     )
     text.pack()
     self.init_ui()
예제 #30
0
 def test_dateentry_drop_down(self):
     """Check whether drop down opens on click."""
     widget = DateEntry(self.window)
     widget.pack()
     self.window.update()
     x, y = widget.winfo_rootx(), widget.winfo_rooty()
     w = widget.winfo_width()
     mouse_controller = Controller()
     mouse_controller.position = (x + w - 2, y + 2)
     self.window.update()
     mouse_controller.press(Button.left)
     self.window.update()
     mouse_controller.release(Button.left)
     self.window.update()
     self.assertTrue(widget._top_cal.winfo_ismapped())