def __init__(self):
     """
     - create all necessary elements
     - configure them with self.configure() method
     """
     self.app = App(title="JIRA log work",
                    width=Application.WIDTH,
                    height=Application.HEIGHT,
                    bg="white",
                    layout="grid")
     self.jira = JiraConnector()
     self.username = get_login_from_filename()
     self.issues = get_issues_from_file()
     self.input_login = TextBox(self.app,
                                self.username,
                                width=20,
                                grid=[1, 1])
     self.input_password = tkinter.Entry(show="*", width=20)
     self.calendar = tkcalendar.Calendar(background="#034DA4",
                                         selectbackground="#034DA4")
     self.issues = Combo(self.app, options=self.issues, grid=[1, 9])
     self.slider = Slider(self.app, start=1, end=8, grid=[1, 4])
     self.comment = TextBox(self.app,
                            "<comment>",
                            width=30,
                            height=4,
                            grid=[0, 10],
                            multiline=True)
     self.ok = self._create_send_button()
     self.how_to = PushButton(self.app,
                              text="How to?",
                              command=self._generate_info,
                              grid=[1, 10],
                              align="left")
     self.configure()
示例#2
0
    def __init__(self, parent, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent

        window = tk.Frame(self, width=self.WIDTH, height=self.HEIGHT)
        window.pack(fill="both", expand=True)

        form = tk.Frame(window, borderwidth=2, relief="groove")
        form.place(relx=.05, rely=.05, relwidth=.9, relheight=.9)

        from_frame = FormRow(form, "From:")
        from_frame.pack(side=tk.TOP, fill="both")
        to_frame = FormRow(form, "To:")
        to_frame.pack(side=tk.TOP, fill="both")

        date_frame = tk.Frame(form, height=200)
        date_frame.pack(side=tk.TOP, fill="x")
        date_label = tk.Label(date_frame, text="Date:")
        date_label.place(rely=.5, anchor="w")
        date_calendar = tkc.Calendar(date_frame,
                                     foreground="black",
                                     selectforeground="red",
                                     selectbackground="red")
        date_calendar.place(rely=.5, relx=.9, anchor="e")

        form_button = tk.Button(
            form,
            text="SEARCH",
            command=lambda: self.testmethod(date_calendar.selection_get()))
        form_button.pack(side=tk.BOTTOM)
示例#3
0
 def show_calendar(self, controller):
     self.top = tk.Toplevel(self)
     self.top.geometry('{}x{}+{}+{}'.format(300, 250, start_x, start_y))
     self.cald = tkcalendar.Calendar(self.top)
     self.cald.pack(fill='both', expand=True)
     button = ttk.Button(self.top,
                         text='Okay',
                         style='',
                         command=lambda: self.print_sel(controller))
     button.pack(anchor='s')
示例#4
0
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        self.configure(width=1250, height=500)

        self.frCal = Frame(self)
        self.frCal.place(relx=0, rely=0)
        self.frCal.configure(bd=1, relief=RAISED)
        self.calWidget = tkcalendar.Calendar(self.frCal,
                                             showweeknumbers=False,
                                             locale="ru_RU",
                                             maxdate=self.today)
        self.calWidget.pack()
        self.calWidget.bind('<<CalendarSelected>>', self.getDate)

        self.dayDataFrame = Frame(self)
        self.dayDataFrame.grid_propagate(0)
        self.dayDataFrame.place(relx=0, rely=1, anchor=SW)
        self.dayDataFrame.configure(width=1250,
                                    height=300,
                                    bd=1,
                                    relief=RAISED)

        self.tableModel = TableModel()
        self.table = TableCanvas(self.dayDataFrame,
                                 cellwidth=300,
                                 model=self.tableModel,
                                 rowheight=25)
        self.table.show()

        self.drawFrame = Frame(self)
        self.drawFrame.grid_propagate(0)
        self.drawFrame.place(relx=1, rely=0, anchor=NE)
        self.drawFrame.configure(width=966, height=200, bd=1, relief=RAISED)

        self.createCanvas()

        self.dateList = []
        self.hourUsed = [0 for i in range(24)]

        self.strInfo = StringVar()
        self.labelInfo = Label(self,
                               textvariable=self.strInfo,
                               width=30,
                               height=1,
                               bg='white',
                               bd=1,
                               relief=RAISED,
                               font='Arial 10')
        self.strInfo.set('Test')
        self.labelInfo.place(x=0, y=175)

        self.createFileList()
        self.createTable()
        self.readReportFile(self.today)
示例#5
0
    def __init__(self,
                 primary,
                 text: str,
                 is_information: bool,
                 add_calendar: bool = False) -> None:
        self.password_value = ""
        self.date_value = ""
        self.top = tkinter.Toplevel(primary)
        self.top.resizable(0, 0)
        if add_calendar:
            now = datetime.now()
            self._date_str_frame = tkinter.Frame(self.top)
            self._dynamic_value = tkinter.StringVar(
                self._date_str_frame,
                tkcalendar.Calendar.date.today().strftime("%d.%m.%Y"),
            )
            self._date_label = tkinter.Label(self._date_str_frame,
                                             textvariable=self._dynamic_value)
            self._date_label.pack(pady=10, padx=30)
            self._cal = tkcalendar.Calendar(
                self.top,
                selectmode="day",
                firstweekday="sunday",
                mindate=now,
                maxdate=now + timedelta(90),
                showweeknumbers=False,
                date_pattern="dd.mm.yyyy",
                selectbackground="blue",
                weekendbackground="white",
                textvariable=self._dynamic_value,
                year=now.year,
                month=now.month,
                day=now.day,
            )
            self._cal.pack(pady=20, fill="both", expand=True, padx=10)
            self._dynamic_value.set(
                f"{self._cal.selection_get().strftime('%d.%m.%Y')}")
            self._date_str_frame.pack()

        self._label = tkinter.Label(self.top, text=text)
        self._label.pack(pady=20, padx=30)
        if not is_information:
            self._entry = tkinter.Entry(self.top, show="*")
            self._entry.pack(pady=20, padx=40)
        self._button = tkinter.ttk.Button(self.top,
                                          text="OK",
                                          command=self._cleanup)
        self._button.pack(pady=20, padx=40)
示例#6
0
    def add_widgets_grid12(self):
        """
        Create tkCalendar widget to utilize calendar type function
        
        """
        today = dt.date.today()
        mindate = dt.date(year=(int(2020) - 1),
                          month=int(today.month),
                          day=int(today.day))
        maxdate = today + dt.timedelta(days=365)

        self.cal = tkc.Calendar(self.f12,
                                font="Arial 14",
                                selectmode='day',
                                locale='en_US',
                                background=BG,
                                foreground=FG,
                                headersbackground=BG,
                                headersforeground=DGR,
                                bordercolor=DGR,
                                normalbackground=BG,
                                normalforeground=FG,
                                weekendbackground=BG,
                                weekendforeground=FG,
                                selectbackground=DGR,
                                selectforeground='black',
                                othermonthforeground='dim gray',
                                othermonthbackground=BG,
                                othermonthweforeground='dim gray',
                                othermonthwebackground=BG,
                                mindate=mindate,
                                maxdate=maxdate,
                                disabledforeground='red',
                                tooltipbackground=BG,
                                tooltipforeground=DGR,
                                cursor="hand1",
                                year=int(today.year),
                                month=int(today.month),
                                day=int(today.day))

        self.cal.grid(row=0, padx=25, pady=25., sticky=tk.NSEW)
        self.cal.bind('<<CalendarMonthChanged>>', None)
示例#7
0
            def createCalendar():
                top = tk.Toplevel()
                x = self.window.winfo_x()
                y = self.window.winfo_y()
                top.geometry("+%d+%d" % (x + self.posx, y + self.posy))

                cal = tc.Calendar(
                    top,
                    font="Georgia 14",
                    selectmode='day',
                    locale="pl",
                    textvariable=calendar,
                    foreground="red",
                    selectforeground="red",
                    background="grey",
                    showweeknumbers=False,
                )
                cal.pack(fill="both", expand=True)
                cal.bind('<<CalendarSelected>>',
                         lambda event: redrawLabel(-20, top))
示例#8
0
    def show_calendar(btn: str):
        calendar_window = tkinter.Tk()
        calendar_window.title("Calendar")

        calendar = tkc.Calendar(calendar_window,
                                selectmode="day",
                                year=datetime.now().year,
                                month=datetime.now().month,
                                day=datetime.now().day,
                                date_pattern="y-mm-dd")

        def date_picked(event):
            if btn == "from":
                update_start_date(calendar.get_date())
                button_date_from["text"] = calendar.get_date()
            else:
                update_end_date(calendar.get_date())
                button_date_to["text"] = calendar.get_date()
            calendar_window.destroy()

        calendar.pack(side=tkinter.LEFT, fill=tkinter.X, expand=False)
        calendar.bind('<<CalendarSelected>>', date_picked)
示例#9
0
def interfaz():

    self.geometry('550x350')
    self.configure(bg='beige')
    self.title('Cliente')

    botonFC = tkinter.Button(self, text="Elegir carpeta", command=filechooser)
    botonFC.grid(row=1, column=0, columnspan=1)

    boton1 = tkinter.Button(self, text="Ejecutar", command=Ejecutar)
    boton1.grid(row=1, column=3, columnspan=1)

    Label1 = tkinter.Label(self, text="Programar antivirus")
    Label1.grid(row=2, column=4, columnspan=2)

    Label2 = tkinter.Label(self, text="Fecha")
    Label2.grid(row=7, column=0, columnspan=1)

    Label3 = tkinter.Label(self, text="Hora")
    Label3.grid(row=7, column=10, columnspan=2)

    calendar = tkcalendar.Calendar()

    calendar.grid(row=8, column=3, columnspan=2)

    spin1.grid(row=7, column=12, columnspan=2)

    Label4 = tkinter.Label(self, text="Minutos")

    Label4.grid(row=7, column=15, columnspan=2)

    spin2.grid(row=7, column=18, columnspan=2)

    boton2 = tkinter.Button(self, text="Programar", command=Programar)

    boton2.grid(row=8, column=14, columnspan=2)

    self.mainloop()
示例#10
0
def date_func():
    def print_sel():
        for widget in root.winfo_children():
            widget.forget()
        l=tk.Label(root, text="Date chosen: " + str(ent.selection_get()),fg='red',bg="black",font="Calibri 22")
        l.pack(anchor="n",fill=tk.X)
        user_date=ent.selection_get()
        user_day=weekday[user_date.weekday()]
        di = ImageTk.PhotoImage(Image.open("t.jpg"))
        di_label = tk.Label(root, image=di, bg="black")
        di_label.pack(anchor="n",fill="both",expand="yes")
        di_label.image = di
        back_button = tk.Button(root, text="Back",font="Chalkboard 15",fg="red", command=opening_screen)
        back_button.pack(side="bottom", fill=tk.X)
        time_button=tk.Button(root, text="Choose time",font="Chalkboard 15",fg="red", command=lambda: time_func(user_date,user_day))
        time_button.pack(side="bottom",fill=tk.X)
    for widget in root.winfo_children():
        widget.forget()
    ent = tkcalendar.Calendar(root,font="Comic 20",selectmode="day",year=2019,month=10,day=28,foreground="red",bg="black", background="blue",selectforeground="red")
    ent.pack(side="top",expand=True,fill=tk.BOTH)
    ok_button=tk.Button(root,text="OK",fg="red",font="Chalkboard 16",highlightbackground="black", command=print_sel)
    ok_button.pack(fill=tk.X)
    back_button=tk.Button(root,text="Back",fg="red",font="Chalkboard 16",highlightbackground="black",command=opening_screen)
    back_button.pack(fill=tk.X)
示例#11
0
        label10M_.delete(0,tk.END)
        label1M_.insert(0,todaysSample[2])
        label2M_.insert(0,todaysSample[3])
        label3M_.insert(0,todaysSample[4])
        label4M_.insert(0,todaysSample[5])
        label5M_.insert(0,todaysSample[6])
        label6M_.insert(0,todaysSample[7])
        label7M_.insert(0,todaysSample[8])
        label8M_.insert(0,todaysSample[9])
        label9M_.insert(0,todaysSample[10])
        label10M_.insert(0,todaysSample[11])

        T_.insert(tk.END, todaysSample[1])
    else:
        T_.insert(tk.END, "Notes go here")        

#CALENDER/OPEN BUTTON WIDGETS
calendar_ = tkcalendar.Calendar(master = calendarRoot)
openButton_ = tk.Button(master = calendarRoot, text = "View", command = openDay_)
calendar_.grid(row = 1, column = 1, columnspan = 3)
openButton_.grid(row = 3, column = 2)


#/ / // / / /  / / / / / / / / / // / / / / / / / / / / / / / // / / / 
#CALENDAR ENDS
#/ / // / / /  / / / / / / / / / // / / / / / / / / / / / / / // / / / 

c.mainloop()
calendarRoot.mainloop()
mainMenuRoot.mainloop()
示例#12
0
import tkinter as tk
import tkcalendar as tkcal
win = tk.Tk()  #в
win.geometry("600x400+100+200")
win.title('privet')
cal = tkcal.Calendar(win)
cal.pack()
win.mainloop()
示例#13
0
user_label.pack(side=tk.LEFT)

user_combobox = ttk.Combobox(
    assign_user_frame, values=["User1", "User2", "User3", "User4", "User5"])
user_combobox.pack(side=tk.LEFT)

#Closure date section
calendar_frame = tk.Frame(root)
calendar_frame.pack()

closure_date_label = tk.Label(calendar_frame, text="Choose closure date")
closure_date_label.pack(side=tk.LEFT)

closure_date_picker = tkc.Calendar(calendar_frame,
                                   selectmode="day",
                                   year=2020,
                                   month=5,
                                   day=22)
closure_date_picker.pack(side=tk.LEFT)

closure_date_btn = tk.Button(calendar_frame, text="Submit date")
closure_date_btn.pack(side=tk.BOTTOM)

#Submit task section
submit_frame = tk.Frame(root)
submit_frame.pack()

submit_btn = tk.Button(submit_frame, text="Submit task")
submit_btn.pack(side=tk.LEFT)

cancel_btn = tk.Button(submit_frame, text="Cancel")
    def __init__(self, parent, controller):
        tk.Toplevel.__init__(self, parent)
        self.resizable(False, False)
        self.title("Mission and Downlink")

        self.grab_set()  # only allow window to react

        self.controller = controller

        # Container for mission and downlink widgets
        self.container = tk.Frame(self)
        self.container.pack(padx=30, pady=10)

        self.top_container = tk.Frame(self.container)
        self.top_container.pack()

        self.bottom_container = tk.Frame(self.container)
        self.bottom_container.pack()

        self.mission_timestamp_container = tk.Frame(self.top_container)
        self.mission_timestamp_container.pack(side=tk.LEFT, padx=10, pady=10)

        self.mission_definition_container = tk.Frame(self.top_container)
        self.mission_definition_container.pack(side=tk.LEFT,
                                               padx=10,
                                               pady=10,
                                               expand=1,
                                               fill="both")

        self.downlink_timestamp_container = tk.Frame(self.top_container)
        self.downlink_timestamp_container.pack(side=tk.RIGHT, padx=10, pady=10)

        # Mission start date labelframe
        self.mission_start_date_frame = tk.LabelFrame(
            self.mission_timestamp_container, text="Mission Start Date")
        self.mission_start_date_frame.pack(expand=1,
                                           fill="both",
                                           padx=3,
                                           pady=3)

        # Mission start date label
        self.mission_start_date_label = tk.Label(
            self.mission_start_date_frame, text="Select Mission Start date:")
        self.mission_start_date_label.pack(side=tk.TOP)

        # Mission start calendar
        self.mission_calendar_container = tk.Frame(
            self.mission_start_date_frame)
        self.mission_calendar_container.pack(padx=5, pady=3)
        self.mission_start_calendar = tkcalendar.Calendar(
            self.mission_calendar_container, date_pattern='y-mm-dd')
        self.mission_start_calendar.pack(side=tk.BOTTOM)

        # Mission start time labelframe
        self.mission_start_time_frame = tk.LabelFrame(
            self.mission_timestamp_container, text="Mission Start Time")
        self.mission_start_time_frame.pack(expand=True,
                                           fill="both",
                                           padx=3,
                                           pady=3)

        # Mission start time label
        self.mission_start_time_container = tk.Frame(
            self.mission_start_time_frame)
        self.mission_start_time_container.pack(padx=5, pady=3)
        self.mission_start_time_label = tk.Label(
            self.mission_start_time_container,
            text="Select Mission Start time:")
        self.mission_start_time_label.pack()

        # Mission start time selector
        self.mission_start_time_picker_container = tk.Frame(
            self.mission_start_time_container)
        self.mission_start_time_picker_container.pack()
        self.mission_start_time_picker = TimestampPicker(
            self.mission_start_time_picker_container)

        # Mission number of images
        self.mission_number_images_frame = tk.LabelFrame(
            self.mission_definition_container, text="Mission Image Count")
        self.mission_number_images_frame.pack(expand=1,
                                              fill="both",
                                              padx=3,
                                              pady=3)

        self.mission_number_images_container = tk.Frame(
            self.mission_number_images_frame)
        self.mission_number_images_container.pack(
            padx=5, pady=5, expand=True,
            fill="none")  # Centralize the widget in labelframe

        self.image_number_selection_label = tk.Label(
            self.mission_number_images_container, text="Select images count:")
        self.image_number_selection_label.pack()

        # Mission number of image selector
        self.image_number_selection = tk.Spinbox(
            self.mission_number_images_container,
            from_=1,
            to=3,
            width=5,
            increment=1,
            state='readonly',
            readonlybackground='white',
            justify=tk.CENTER)
        self.image_number_selection.pack(padx=5, pady=5)

        # Mission time interval container
        self.mission_interval_frame = tk.LabelFrame(
            self.mission_definition_container, text="Mission Image Interval")
        self.mission_interval_frame.pack(expand=True,
                                         fill="both",
                                         padx=3,
                                         pady=3)

        self.mission_time_interval_container = tk.Frame(
            self.mission_interval_frame)
        self.mission_time_interval_container.pack(
            padx=5, pady=5, expand=True,
            fill="none")  # Centralize the widget in labelframe

        # Mission time interval label
        self.interval_selection_label = tk.Label(
            self.mission_time_interval_container,
            text="Select image interval :")
        self.interval_selection_label.pack()

        # Mission time interval selector
        self.interval_selection = tk.Spinbox(
            self.mission_time_interval_container,
            from_=1000,
            to=5000,
            width=5,
            increment=1000,
            state='readonly',
            readonlybackground='white',
            justify=tk.CENTER)
        self.interval_selection.pack()

        # Downlink start date labelframe
        self.downlink_start_date_frame = tk.LabelFrame(
            self.downlink_timestamp_container, text="Downlink Start Date")
        self.downlink_start_date_frame.pack(expand=1,
                                            fill="both",
                                            padx=3,
                                            pady=3)

        # Downlink start date label
        self.downlink_start_date_label = tk.Label(
            self.downlink_start_date_frame, text="Select Downlink Start date:")
        self.downlink_start_date_label.pack(side=tk.TOP)

        # Downlink start calendar
        self.downlink_calendar_container = tk.Frame(
            self.downlink_start_date_frame)
        self.downlink_calendar_container.pack(padx=5, pady=3)
        self.downlink_start_calendar = tkcalendar.Calendar(
            self.downlink_calendar_container, date_pattern='y-mm-dd')
        self.downlink_start_calendar.pack(side=tk.BOTTOM)

        # Downlink start time labelframe
        self.downlink_start_time_frame = tk.LabelFrame(
            self.downlink_timestamp_container, text="Downlink Start Time")
        self.downlink_start_time_frame.pack(expand=1,
                                            fill="both",
                                            padx=3,
                                            pady=3)

        # Downlink start time label
        self.downlink_start_time_container = tk.Frame(
            self.downlink_start_time_frame)
        self.downlink_start_time_container.pack(padx=5, pady=3)
        self.downlink_start_time_label = tk.Label(
            self.downlink_start_time_container,
            text="Select Downlink Start time:")
        self.downlink_start_time_label.pack()

        # Downlink start time selector
        self.downlink_start_time_picker_container = tk.Frame(
            self.downlink_start_time_container
        )  # Container to store timestamp picker
        self.downlink_start_time_picker_container.pack()
        self.downlink_start_time_picker = TimestampPicker(
            self.downlink_start_time_picker_container)

        # Error message
        self.error_message = tk.StringVar()
        self.error_message_label = tk.Label(self.bottom_container,
                                            textvariable=self.error_message)
        self.error_message_label.pack(side=tk.TOP)

        # Submit button container
        self.button_container = tk.Frame(self.bottom_container)
        self.button_container.pack(side=tk.BOTTOM)
        self.submit_button = tk.Button(
            self.button_container,
            text="Submit",
            command=self.controller.handle_mission_scheduling)
        self.submit_button.pack(padx=5, pady=5)
示例#15
0
文件: cal.py 项目: nyaxru/cal.py
def display_event(eventObject="cal"):
    text.config(state=tk.NORMAL)
    text.delete(1.0, tk.END)
    text.insert(1.0, str(event_read(cal.selection_get())[0]))
    text.config(state=tk.DISABLED)

    event_create()


text = tk.Text(text_frame, wrap=tk.WORD, state=tk.DISABLED)

color_list = ["blue", "red", "green", "yellow", "magenta"]
color_listbox = tk.Listbox(color_frame, selectmode=tk.SINGLE)
for i in color_list:
    color_listbox.insert(tk.END, i)
cal = tkc.Calendar(cal_frame, locale="en_UK")
cal.bind("<<CalendarSelected>>", display_event)
edit_button = tk.Button(button_frame, text="Edit")
save_button = tk.Button(button_frame, text="Save", state=tk.DISABLED)
color_listbox.select_set(0)
pathlib.Path(appdata_dir).mkdir(parents=True, exist_ok=True)

color_listbox.configure(state=tk.DISABLED)
"""
WIP
"""
"""Event section."""


def configuration():
    pass
示例#16
0
import tkinter
from tkinter import ttk
import tkcalendar
import shutil
from datetime import datetime

from tkinter.filedialog import askdirectory
from tkinter.filedialog import askopenfilename

s = socket()
s.connect(("192.168.0.4", 6665))
listaHashesSer = []

self = tkinter.Tk()

calendar = tkcalendar.Calendar()

spin1 = tkinter.Spinbox(self,
                        values=([
                            "00", "01", "02", "03", "04", "05", "06", "07",
                            "08", "09", "10", "11", "12", "13", "14", "15",
                            "16", "17", "18", "19", "20", "21", "22", "23"
                        ]),
                        width=5,
                        state="readonly")

spin2 = tkinter.Spinbox(
    self,
    values=([
        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",
        "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24",
    def Search():
        a=[e1.get()]
        r=con.execute('Select * from entry where name=?',a)
        x=r.fetchall()
        if(not x):  
            messagebox.showinfo('Hello','Book not found in library.')
        else:
            d=x[0][4]
            if(d>0):
                l2.grid(row=3)
                l3.grid(row=4)
                l4.grid(row=5)
                l5.grid(row=6)
                l6.grid(row=11)
                l7.grid(row=10)
                e2.grid(row=3,column=3)
                e3.grid(row=4,column=3)
                e4.grid(row=5,column=3)
                e5.grid(row=6,column=3)
                e6.grid(row=11,column=3)
                e7.grid(row=10,column=3)
                e2.insert(0,x[0][0])
                e3.insert(0,x[0][2])
                e4.insert(0,x[0][3])
                e5.insert(0,x[0][4])

                

                k1.grid(row=7)
                k2.grid(row=8)
                k3.grid(row=9)

                s1.grid(row=7,column=3)
                s2.grid(row=8,column=3)
                s3.grid(row=9,column=3)
                
                cal=tkcalendar.Calendar(root)
                def calen():
                    cal.grid(row=10,column=0)
                    def show(event):
                        global s
                        s=cal.get_date()
                        e6.insert(0,s)
                    cal.bind('<<CalendarSelected>>',show)
                def hidecal():
                    cal.grid_forget()
                def issue():
                    mm=e7.get()
                    nn=e1.get()
                    dates=datetime.strptime(s,'%m/%d/%y').date()
                    kk=dates+timedelta(days=7)
                    kk=datetime.strftime(kk,'%m/%d/%y')
                    a=[]
                    r=con.execute('Select * from student where roll={0}'.format(int(s2.get())))
                    x=r.fetchall()
                    n=0
                    flag=True
                    for i in x:
                        n+=1
                        if(i[3]==e1.get()):
                            flag=False
                            break
                    if(flag==True and n<3):
                        a.append(s1.get())
                        a.append(int(s2.get()))
                        a.append(s3.get())
                        a.append(e1.get())
                        s
                        a.append(s)
                        b=[e1.get()]
                        r=con.execute('Select * from entry where name=?',b)
                        z=r.fetchall()
                        i=z[0][4]-1
                        b.insert(0,i)
                        con.execute('update entry set copy=? where name=?',b)
                        con.commit()
                        con.execute('Insert into student values(?,?,?,?,?)',a)
                        con.commit()
                        messagebox.showinfo('hello','Book issued')
                        clear()
                    elif(n==3):
                         messagebox.showinfo('hello','A student can issue maximum 3 books.')
                    elif(flag==False):
                        messagebox.showinfo('hello','Only one copy of book can be issued per student.')
                        
                    import smtplib
                    fromaddr='*****@*****.**'
                    toaddrs=mm
                    msg="\r\n".join([
                    "From: [email protected]",
                    "To: [email protected]",
                    "Subject: BOOK ISSUE RECEIPT",
                    "",
                    nn+" book has been issued.The book has to be returned on "+kk+"\n\n\nWarm Regards\nNCU LIBRARY"
                    ])
                    username='******'
                    password='******'
                    server=smtplib.SMTP('smtp.gmail.com:587')
                    server.ehlo()
                    server.starttls()
                    server.login(username,password)
                    server.sendmail(fromaddr,toaddrs,msg)
                    server.quit()
                b9=Button(root,text='Calendar',bg='blue',command=calen,font=('Arial','20'))
                b10=Button(root,text='Hide Calendar',bg='blue',command=hidecal,font=('Arial','20'))
                b9.grid(row=12,column=1,rowspan=3,padx=20,pady=50,sticky=E)
                b10.grid(row=12,column=2,rowspan=3,padx=20,pady=50,sticky=E) 
                def clear():
                    e1.delete(0,END)
                    e2.delete(0,END)
                    e3.delete(0,END)
                    e4.delete(0,END)
                    e5.delete(0,END)
                    e6.delete(0,END)
                    e7.delete(0,END)
                    s1.delete(0,END)
                    s2.delete(0,END)
                    s3.delete(0,END)
                b4=Button(root,text='Clear Data',bg='blue',command=clear,font=('Arial','20'))
                b4.grid(row=12,column=5,rowspan=3,padx=20,pady=50,sticky=E)
                b5=Button(root,text='Issue',bg='blue',command=issue,font=('Arial','20'))
                b5.grid(row=12,column=4,rowspan=3,padx=20,pady=50,sticky=E)                  
示例#18
0
implementation_menu.place(relx=0.885, rely=0.035)
""" --- Calendars --- """

start_cal_label = tk.Label(root, text="START DATE")
start_cal_label.config(font=("Calibri", 12, "bold"))
start_cal_label.place(relx=0.493, rely=0.1)

end_cal_label = tk.Label(root, text="END DATE")
end_cal_label.config(font=("Calibri", 12, "bold"))
end_cal_label.place(relx=0.7772, rely=0.1)

start_cal = tkcalendar.Calendar(
    root,
    selectmode="day",
    year=2005,
    month=1,
    day=3,
    locale='en_US',
    date_pattern='MM/dd/yyyy',
    mindate=tkcalendar.calendar_.calendar.datetime.date(2005, 1, 3),
    maxdate=tkcalendar.calendar_.calendar.datetime.date(2020, 11, 27))
start_cal.place(relx=0.422, rely=0.16)

end_cal = tkcalendar.Calendar(
    root,
    selectmode="day",
    year=2020,
    month=11,
    day=27,
    locale='en_US',
    date_pattern='MM/dd/yyyy',
    mindate=tkcalendar.calendar_.calendar.datetime.date(2005, 1, 3),
示例#19
0
#Boton ubicar XLSX
btArchivo = tk.Button(f_g1, text='Seleccionar...', command=on_btArchivo_clic)
btArchivo.config(font=('Arial', 16))  #Configuracion para windows
btArchivo.grid(row=0, column=1)

#Calendario
calendar = cld.Calendar(
    f_g2,
    selectmode='day',
    year=hoy.year,
    month=hoy.month,
    day=hoy.day,
    font=('Arial', 16),  #Configuracion para windows
    locale='es_CO',
    bordercolor='black',
    background='#009600',
    headersbackground='#00b400',
    normalbackground='#b4ffb4',
    weekendbackground='#87ff87',
    othermonthbackground='#32ff32',
    othermonthwebackground='#32ff32',
    othermonthweforeground='black',
    othermonthforeground='black',
    weekendforeground='black',
    normalforeground='black')
calendar.pack(expand=True)

#Boton procesar
btProcesar = tk.Button(f_g3, text='Procesar', command=on_btProcesar_clic)
btProcesar.config(font=('Arial', 16))  #Configuracion para windows
btProcesar.pack()
示例#20
0
    def fire_employee(self):
        page = self.controller.get_page("Em_App")
        curr_empl = str(page.employee.name_box.get())
        if curr_empl.startswith("[Z]"):
            messagebox.showerror(
                "Nie możność", "Nie można zwolnić zwolnionego pracownika", parent=self.controller)
            return

        self.fire_date = ""

        def save():
            global fire_date_
            os.rename("./Pracownicy/" + curr_empl,
                      "./Pracownicy/_" + curr_empl)

            for file in os.listdir("./Roczne podsumowanie/"):
                if str(file).endswith('.json'):
                    with open("./Roczne podsumowanie/" + str(file), "r") as f:
                        x = json.load(f)
                    with open("./Roczne podsumowanie/" + str(file), "w") as f:
                        try:
                            x["employees"][str('_' + curr_empl)
                                           ] = x["employees"].pop(curr_empl)
                        # if employee doesnt exist in summary
                        except KeyError:
                            pass
                        json.dump(x, f, indent=4, ensure_ascii=False)

            with open('./Pracownicy/_' + curr_empl + "/settings.json", "r") as f:
                settings = json.load(f)
            settings["fire_date"] = self.fire_date
            with open('./Pracownicy/_' + curr_empl + "/settings.json", "w") as f:
                json.dump(settings, f, indent=4, ensure_ascii=False)

            page.employee.reload_list()
            page.employee.name_box.current(0)
            page.employee.change_combo()
            page.employee.read_data()
            top.destroy()
            self.controller.focus_set()
            self.controller.set_status(
                f"Zwolniono pracownika {curr_empl} z datą {self.fire_date}")

        def color_day(e):
            global fire_date_
            date_patterns = ['%m/%d/%y', "%d.%m.%Y"]
            for pattern in date_patterns:
                try:
                    x_date = datetime.datetime.strptime(
                        cal.get_date(), pattern).date()
                except:
                    pass
            self.fire_date = str(x_date.strftime("%d/%m/%Y"))

        answer = messagebox.askyesno("Zwolnij pracownika", str(
            "Zwolnić pracownika: \n" + curr_empl))
        if answer:

            messagebox.showinfo("Zwalnianie pracownika",
                                "Wybierz teraz datę zwolnienia pracownika")

            top = Toplevel(background=self.controller.bg)
            top.title("Data zwolnienia")
            top.focus_set()
            cal = tkcalendar.Calendar(top, selectmode='day')
            cal.bind("<<CalendarSelected>>", color_day)
            cal.pack(fill=BOTH, expand=True)
            ok = ttk.Button(top, text="Zapisz", command=lambda: save())
            ok.pack(fill=X, expand=True)
            x = self.controller.winfo_x()
            y = self.controller.winfo_y()
            top.geometry(
                "+%d+%d" % (x + self.controller.winfo_reqwidth()/2 - top.winfo_width()/2, y + 200))
示例#21
0
import pandas
import tkcalendar
import WidgetUtility as util
import datetime as dt

#tool to view, add, and edit food eaten

#main form
root = tkinter.Tk()
root.geometry('1000x600')
frame = tkinter.Frame(root)
frame.grid(column=0, row=0)
root.title("Food Eaten")

#Entry for date / data view
cal = tkcalendar.Calendar(root, font="Arial 14", selectmode='day')
cal.grid(column=0, row=0, columnspan=4, rowspan=8)

#DB connection
conx = pyodbc.connect(
    "DRIVER={SQL SERVER NATIVE CLIENT 11.0};SERVER=(local);DATABASE=DietDb;Trusted_Connection=yes"
)
cursor = conx.cursor()

#widget lists
cmblist = []
qtylist = []
checklist = []
checkvariables = []
foodeatenkeys = []
eatenLabels = []  #order:calories,protein,carbs,totalfat,satfat
import calendar as calendar
import time
import requests, base64

#create a tk window to show the date and time
window = tk.Tk()
window.geometry("350x400")
window.title("calendar")


# create a 24hr digital clock face
def update_clock():
    hours = time.strftime('%H')
    minutes = time.strftime('%M')
    am_or_pm = time.strftime('%p')
    time_text = hours + ':' + minutes
    digital_clock_lbl.config(text=time_text)
    digital_clock_lbl.after(1000, update_clock)  # update the time every second


digital_clock_lbl = tk.Label(window, text='00:00', font='Helvetica 30 bold')
digital_clock_lbl.pack()

update_clock()

# create a calendar and place in window
mycal = tkcal.Calendar(window, setmode='day', date_pattern='d/m/yy')
mycal.pack(padx=10, pady=1)

window.mainloop()
示例#23
0
def startGui():
    date = datetime.datetime.now()
    year = date.strftime("%Y")
    month = date.strftime("%m")
    today = date.strftime("%d")

    fontStyle = eval("'ARIAL', 14, 'bold'")
    rightMargin = eval("(0,50)")

    def startProcess():
        dateLabel.config(text=calendar.get_date())
        global title
        title = titleEntry.get()

        global endDate
        endDate = selectedDateLabel.cget("text")

        global rev
        rev = revEntry.get()

        global pages
        try:
            pages = eval(pagesEntry.get())
        except:
            pag.alert("Por favor Introduzca el número de páginas")
            return

        global documentNumber
        documentNumber = "MMC-WI-" + documentNumberEntry.get()

        root.destroy()

    def updateDate():
        selectedDateLabel.config(text=calendar.get_date())

    root = tk.Tk()
    root.title("Documentation bot")

    mainTitleLabel = tk.Label(root, text="Modificar Instrucción de trabajo")
    mainTitleLabel.config(font=('Arial', 18, 'bold'))

    documentNumberLabel = tk.Label(root, text="No. documento: MMC-WI-")
    documentNumberLabel.config(font=(fontStyle))
    documentNumberEntry = tk.Entry(root, width=10)

    titleLabel = tk.Label(root, text="Titulo:")
    titleLabel.config(font=(fontStyle))
    titleEntry = tk.Entry(root, width=45)
    titleEntry.config(font=fontStyle)

    endDateLabel = tk.Label(root, text="Fecha de Liberación:")
    endDateLabel.config(font=(fontStyle))
    selectedDateLabel = tk.Label(root)
    selectedDateLabel.config(font=fontStyle)

    updateDateButton = tk.Button(text="Seleccionar Fecha", command=updateDate)
    updateDateButton.config(font=fontStyle)

    revLabel = tk.Label(root, text="Revisión:")
    revLabel.config(font=(fontStyle))
    revEntry = tk.Entry(root, width=9)

    pagesLabel = tk.Label(root, text="   No. de Hojas:")
    pagesLabel.config(font=(fontStyle))
    pagesEntry = tk.Entry(root, width=10)

    dateLabel = tk.Label(text="")
    dateLabel.config(font=('ARIAL', 14, 'bold'),
                     borderwidth=2,
                     relief="solid",
                     highlightbackground="green")
    calendar = tkcalendar.Calendar(selectmode='day',
                                   month=int(month),
                                   year=int(year),
                                   day=int(today),
                                   locale='es_mx')
    startButton = tk.Button(text="Iniciar", command=startProcess)
    startButton.config(font=('ARIAL', 15, 'bold'), fg='green')

    mainTitleLabel.grid(column=0, row=1, columnspan=6, pady=(10, 20))
    titleLabel.grid(column=0, row=2, sticky="E", padx=(30, 0))
    titleEntry.grid(column=1, row=2, sticky="w")
    documentNumberLabel.grid(column=4,
                             row=2,
                             columnspan=1,
                             sticky="E",
                             padx=(30, 0))
    documentNumberEntry.grid(column=3,
                             row=2,
                             columnspan=3,
                             sticky="E",
                             padx=rightMargin)
    endDateLabel.grid(column=0, row=3, padx=(30, 0), columnspan=2)
    selectedDateLabel.grid(column=1, row=3, sticky="E", padx=(0, 60))
    revLabel.grid(column=3, row=3, sticky="w", padx=(30, 0))
    revEntry.grid(column=4, row=3, sticky="w")
    pagesLabel.grid(column=4, row=3, sticky="E")
    pagesEntry.grid(column=5, row=3, sticky="W", padx=rightMargin)
    calendar.grid(column=0,
                  row=4,
                  sticky="wE",
                  columnspan=3,
                  padx=(100, 0),
                  pady=(20, 0))
    updateDateButton.grid(column=1,
                          row=5,
                          columnspan=2,
                          sticky="nesw",
                          pady=(5, 30))
    startButton.grid(column=3,
                     row=4,
                     sticky="WES",
                     padx=(20, 50),
                     columnspan=3)

    updateDate()

    root.mainloop()
示例#24
0
    def __init__(self, root):
        self.root = root
        self.root.title("โปรแกรม JSR")
        self.root.geometry("1350x700+0+0")

        title = Label(self.root,
                      text="โปรแกรม JSR",
                      bd=10,
                      relief=GROOVE,
                      font=("times new roman", 40, "bold"),
                      bg="DarkSlateGray",
                      fg="Snow")
        title.pack(side=TOP, fill=X)

        #================== Manage Frame =====================================
        def grab_date_A():
            dataCAL = []
            data_cal_1 = cal.selection_get()
            print('data_cal_1>>>>>>>>🌌', data_cal_1)
            dataCAL.append(data_cal_1)
            dataCAL[0] = dataCAL[0].strftime("%d/%m/%Y")
            my_label_A.config(text=dataCAL[0])
            print(dataCAL[0])

        def grab_date_B():
            dataCAL = []
            data_cal_1 = cal.selection_get()
            print('data_cal_1>>>>>>>>🌌', data_cal_1)
            dataCAL.append(data_cal_1)
            dataCAL[0] = dataCAL[0].strftime("%d/%m/%Y")
            my_label_B.config(text=dataCAL[0])
            print(dataCAL[0])

        Manage_Frame = Frame(self.root, bd=4, relief=RIDGE, bg="DarkSlateGray")
        Manage_Frame.place(x=20, y=100, width=450, height=560)

        m_title = Label(Manage_Frame,
                        text="เลือกตัวเลือก",
                        bg="DarkSlateGray",
                        fg="Snow",
                        font=("times new roman", 20, "bold"))
        m_title.grid(row=0, columnspan=1, pady=0)

        lbl_1_roll = Label(Manage_Frame,
                           text="Column 1.",
                           bg="DarkSlateGray",
                           fg="Snow",
                           font=("times new roman", 15, "bold"))
        lbl_1_roll.grid(row=1, column=0, pady=10, padx=20, sticky="w")

        combo_gender = ttk.Combobox(Manage_Frame,
                                    font=("times new roman", 10, "bold"))
        combo_gender['values'] = ('1', '2')
        combo_gender.grid(row=1, column=1, padx=20, pady=10)

        lbl_2_roll = Label(Manage_Frame,
                           text="Column 2.",
                           bg="DarkSlateGray",
                           fg="Snow",
                           font=("times new roman", 15, "bold"))
        lbl_2_roll.grid(row=2, column=0, pady=10, padx=20, sticky="w")

        combo_2_gender = ttk.Combobox(Manage_Frame,
                                      font=("times new roman", 10, "bold"))
        combo_2_gender['values'] = ('1', '2')
        combo_2_gender.grid(row=2, column=1, padx=20, pady=10)

        lbl_3_roll = Label(Manage_Frame,
                           text="Roll No.",
                           bg="DarkSlateGray",
                           fg="Snow",
                           font=("times new roman", 15, "bold"))
        lbl_3_roll.grid(row=3, column=0, pady=10, padx=20, sticky="w")

        txt_3_Roll = Entry(Manage_Frame,
                           font=("times new roman", 10, "bold"),
                           bd=5,
                           relief=GROOVE)
        txt_3_Roll.grid(row=3, column=1, pady=10, padx=20, sticky="w")

        cal = tkC.Calendar(Manage_Frame,
                           selectmone='day',
                           year=2021,
                           month=3,
                           day=16)
        cal.grid(row=5, column=1, padx=0, pady=30)

        my_button_A = Button(Manage_Frame,
                             text='Starting date',
                             command=grab_date_A)
        my_button_A.grid(row=6, column=0, padx=0, pady=0)

        my_button_B = Button(Manage_Frame,
                             text='End date',
                             command=grab_date_B)
        my_button_B.grid(row=6, column=1, padx=0, pady=0)

        my_label_A = Label(Manage_Frame, text='')
        my_label_A.grid(row=7, column=0, padx=0, pady=10)

        my_label_B = Label(Manage_Frame, text='')
        my_label_B.grid(row=7, column=1, padx=0, pady=10)

        #================== Detail Frame =====================================
        Detail_Frame = Frame(self.root, bd=4, relief=RIDGE, bg="DarkSlateGray")
        Detail_Frame.place(x=500, y=100, width=800, height=560)
示例#25
0
	def __init__(self,user,frame):


		#on start, calculate goals

		#Entry for date / data view
		cal = tkcalendar.Calendar(frame,font="Arial 14", selectmode='day',state='disabled')
		cal.grid(column = 0, row = 0,columnspan = 4,rowspan=8)
		#Display user data on top of form
		lFirstName = ttk.Label(frame,text= 'First Name: \n{}'.format(user.FirstName)).grid(column=4,row=0,rowspan = 2)
		lLastName = ttk.Label(frame,text = 'Last Name: \n{}'.format(user.LastName)).grid(column=5,row=0,rowspan=2)

		lMultiplier = ttk.Label(frame,text = 'Activity Multiplier').grid(column=6,row=0)
		eMultiplier = tkinter.Entry(frame)
		eMultiplier.grid(column = 6,row = 1)
		eMultiplier.insert(0,user.Activity)

		lWeight = ttk.Label(frame,text = "Current Weight").grid(column = 7, row = 0)
		eWeight = tkinter.Entry(frame)
		eWeight.grid(column = 7,row = 1)
		eWeight.insert(0,user.Weight)

		lHeight = ttk.Label(frame,text = "Height: \n {}'".format(str(int(user.Height/12)))+'{}"'.format(str(user.Height%12))).grid(column = 8, row = 0, rowspan=2)

		lAge = ttk.Label(frame,text = 'Age: \n' + str(user.Age(cal.selection_get()))).grid(column=9,row=0,rowspan=2)

		datestuff = Util.DateInfo.initFromString(cal.get_date())

		cmbGoal = SQLBox(frame,"SELECT * FROM Goaltypes",defaultindex=(user.Goal-1))
		cmbGoal.grid(column = 0)


		lCalReq = tkinter.Label(frame,text= 'Average Daily Requirements: {}'.format(round(user.CalcCalories(),2)))
		lCalReq.grid(column=0)

		#display calorie cycle for upcoming 7 days
		user.calcTargets()
		dates = []
		dates.append(DateInfo.initFromDate(cal.selection_get()))
		for x in range(1,len(user._scheduledCalories)):
			dates.append(DateInfo.initFromDateID(dates[0].data[0][0] + x))
		datestring=[(str(d.data[0][4]) + ' ' + str(d.data[0][12]) + ' ' + str(d.data[0][7]) + ' ' + str(d.data[0][17])) for d in dates]
		caloriestring = [str(round(r,2)) for r in user._scheduledCalories]

		display = DataDisplay(frame,datestring,caloriestring)
		display.grid(column=0)

		def calcDisplay():
			#use current info displayed to update user object and display everything
			user.Weight = float(eWeight.get())
			user.Activity = round(float(eMultiplier.get()),2)
			user.Goal =  int(cmbGoal.get().split(",")[0][1:])
			user.calcTargets()
			new_caloriestring = [str(round(r,2)) for r in user._scheduledCalories]
			display.UpdateData(datestring,new_caloriestring)
			lCalReq.config(text= 'Average Daily Requirements: {}'.format(round(user.CalcCalories(),2)))

		bCalc = ttk.Button(frame,text="Calculate Calorie Requirements",command=calcDisplay)
		bCalc.grid(column=0)
		def submit():
			calcDisplay()
			user.submitTargets()
		bSubmit = ttk.Button(frame,text="Submit",command=submit)
		bSubmit.grid(column=1,row=bCalc.grid_info()['row'])
import pandas as pd
import tkinter as tk
import tkcalendar as tkC

root = tk.Tk()
root.title('Codemy.com')
# rott.iconditmap()
root.geometry('600x700')

cal_A = tkC.Calendar(root, selectmone='day', year=2021, month=3, day=16)
cal_A.pack(pady=20)

def grab_date_A():


    dataCAL = []
    data_cal_1 = cal_A.selection_get()
    print('data_cal_1>>>>>>>>🌌' , data_cal_1)
    dataCAL.append(data_cal_1)
    dataCAL[0] = dataCAL[0].strftime("%d/%m/%Y")

    print(dataCAL[0])
    # print('data_cal_2>>>>>>>>🌌' , data_cal_2)
    # data_cal_3 = data_cal_2.pd.dt.strftime('%d/%m/%Y')
    # my_label_A.config(text=data_cal_3)
    # print(data_cal_3)
    # my_label_A.config(text=data_cal_1)
    # print(data_cal_1)

def grab_date_B():
    my_label_B.config(text=cal_B.get_date())
    def printExcel(self):
        self.calendar_win = Toplevel(self.sessionWin)
        Label(self.calendar_win, text='Choose date').pack(padx=10, pady=10)

        today = date.today()

        mindate = date(year=2010, month=1, day=1)
        maxdate = today
        check_validate = StringVar()
        validate = Label(self.calendar_win,
                         text='Report Exist',
                         textvariable=check_validate,
                         font=('comic sans ms', 13, 'bold'),
                         foreground='Green')

        cal = tkcalendar.Calendar(self.calendar_win,
                                  font=('comic sans ms', 15, 'bold'),
                                  selectmode='day',
                                  locale='en_US',
                                  mindate=mindate,
                                  maxdate=maxdate,
                                  disabledforeground='red',
                                  cursor="hand1",
                                  year=today.year,
                                  month=today.month,
                                  day=today.day)

        def print_report():
            DIR_PATH = str(
                datetime.now().strftime("%B")) + f"_{datetime.now().year}/"
            SAVE_PATH = '//Zerozed-pc/shared/DB/Sales_Report/' + DIR_PATH
            get_date = cal.selection_get()
            EXCEL_FILE = SAVE_PATH + str(get_date) + '.xlsx'

            if os.path.exists(os.path.abspath(EXCEL_FILE)):
                printfile = os.path.abspath(EXCEL_FILE)
                try:
                    try:
                        with open('Config/printerConfig.ini', 'r') as f:
                            check_print = [
                                i.strip("\n") for i in f.readlines()
                            ]
                            win32print.SetDefaultPrinter(str(check_print[3]))
                            f.close()
                    except Exception as e:
                        messagebox.showerror(
                            "Printer Error",
                            f"Cant Print, Please contact service provider +60179593309\n{e}"
                        )

                    os.startfile(rf"{printfile}", 'print')
                    self.calendar_win.destroy()
                    messagebox.showinfo(
                        "Printing",
                        f"Report on {get_date} Printed Successfully")
                except Exception as error:
                    messagebox.showerror("Printer error", error)
                    self.calendar_win.destroy()
            else:
                messagebox.showerror("Not Found", "Your Report NOT FOUND")
                self.calendar_win.focus_force()

        def is_validate(event):
            DIR_PATH = str(
                datetime.now().strftime("%B")) + f"_{datetime.now().year}/"
            SAVE_PATH = '//Zerozed-pc/shared/DB/Sales_Report/' + DIR_PATH
            get_date = cal.selection_get()
            EXCEL_FILE = SAVE_PATH + str(get_date) + '.xlsx'

            if os.path.exists(os.path.abspath(EXCEL_FILE)):
                validate.config(foreground='green')
                check_validate.set(f"Report {get_date} Exist")
            else:
                validate.config(foreground='red')
                check_validate.set(f"Report {get_date} Not Exist")

        self.calendar_win.bind("<Button-1>", is_validate)
        cal.pack(fill="both", expand=True)
        Button(self.calendar_win,
               text="Print",
               style='W.TButton',
               command=print_report).pack()
        validate.pack()
示例#28
0
 def body(self, master):
     self.calendar = tkcalendar.Calendar(master)
     self.calendar.pack()
示例#29
0
    def add_holiday(self):

        page = self.controller.get_page("Em_App")
        name = page.employee.name.get()

        top = Toplevel(background=self.controller.bg)
        top.title("Dodawanie świąt")
        top.focus_set()

        # check if file exists
        if not os.path.isfile('./Harmonogramy/' + 'swieta.json'):
            with open('./Harmonogramy/' + 'swieta.json', 'w') as f:
                to_save = {
                    "2019": {},
                    "2020": {}
                }
                json.dump(to_save, f, indent=4)

        # load the existing holiday
        with open('./Harmonogramy/' + 'swieta.json', 'r') as f:
            data = json.load(f)

        # list of added and deleted holidays
        add_holiday = []
        remove_holiday = []

        # color a day, if colored then decolor
        def color_day(e):
            date_patterns = ['%m/%d/%y', "%d.%m.%Y"]
            for pattern in date_patterns:
                try:
                    x_date = datetime.datetime.strptime(
                        cal.get_date(), pattern).date()
                except:
                    pass
            if cal.get_calevents(x_date):
                remove_holiday.append(x_date)
                cal.calevent_remove(date=x_date)
            else:
                add_holiday.append(x_date)
                cal.calevent_create(x_date, 'X', 'swieto')

        def save():
            # create lists without duplicats
            add = list(set(add_holiday) - set(remove_holiday))
            rmv = list(set(remove_holiday) - set(add_holiday))
            for holiday in add:
                if not str(holiday.year) in data:
                    data[str(holiday.year)] = {}
                if not str(holiday.month) in data[str(holiday.year)]:
                    data[str(holiday.year)][str(holiday.month)] = []
                data[str(holiday.year)][str(holiday.month)].append(holiday.day)
            for not_holiday in rmv:
                if not str(not_holiday.year) in data:
                    data[str(not_holiday.year)] = {}
                if not str(not_holiday.month) in data[str(not_holiday.year)]:
                    data[str(not_holiday.year)][str(not_holiday.month)] = []
                data[str(not_holiday.year)][str(
                    not_holiday.month)].remove(not_holiday.day)

            with open('./Harmonogramy/' + 'swieta.json', 'w') as f:
                json.dump(data, f, indent=4)

            top.destroy()
            self.controller.focus_set()
            self.controller.set_status("Zapisano świętą")

        cal = tkcalendar.Calendar(top, selectmode='day')
        cal.tag_config('swieto', background='blue')
        cal.bind('<<CalendarSelected>>', color_day)
        cal.pack(fill="both", expand=True)
        ttk.Button(top, text="Zapisz", command=save).pack(expand=True)
        x = self.controller.winfo_x()
        y = self.controller.winfo_y()
        top.geometry("+%d+%d" % (x + self.controller.winfo_reqwidth() /
                                 2 - top.winfo_width()/2, y + 200))

        # add exisiting holiday
        for year in data:
            for month in data[year]:
                for day in data[year][month]:
                    date = datetime.date(
                        year=int(year), month=int(month), day=int(day))
                    cal.calevent_create(date, 'X', 'swieto')
示例#30
0
b1.grid(row=2, column=1, pady=5)  #Adicionar
b2.grid(row=4, column=1, pady=5)  #Salvar em:,

#frame6
b4.grid(row=2, column=1, sticky="w")  #Remover
b5.grid(row=3, column=1, pady=15)  #Remover todos
b6.grid(row=6, column=1, sticky="w", pady=135)

# ComboBox
c1 = ttk.Combobox(frame1, width=30)
c1.grid(row=2, column=0, sticky="w")
c1['values'] = i1.sigla
c1.current(2)

# Calendar
cal = tkcalendar.Calendar(frame2)
cal.bind('<<CalendarSelected>>', calButtonMouse)
cal.grid(row=2, column=0, sticky="w")

# Labels
l1 = Label(frame1, text="AutoRbmcIbge", font=("Helvetica", 20))  #fixo
l2 = Label(frame1, text="Bases")  #fixo
l3 = Label(frame1, text=version)  #fixo
l4 = Label(frame5, text="Data atual:")  #fixo
l5 = Label(frame5, text="Dia do ano de hoje:")  #fixo
l6 = Label(frame5, text="%s/%s/%s" % (day, month, year))  # alterar na execução
l7 = Label(frame5, text=i1.today_gnss)  # alterar na execução
#l8=Label(frame1,text="testar") #relógio para testar o update
l9 = Label(frame1, text=local_folders.get())
#frame 2
l10 = Label(frame2, text="Data do levantamento:")