Beispiel #1
0
def init() -> ThemedTk:
    window = ThemedTk()
    window.get_themes()
    window.set_theme('itft1')

    window.title("Prots2Net app")
    window.geometry('1080x1080')
    window.resizable(width=True, height=True)

    tab_control, tab1, tab2, tab3, tab4 = create_tab_control(window)

    tree_node = create_protein_tab(tab3)
    tree_edge = create_edge_tab(tab4)

    sec_txt, combo_1, combo_2 = create_main_tab(tab1)

    bar = ttk.Progressbar(tab1, length=100)
    bar['value'] = 0
    bar.grid(column=1, row=6)
    bar_text = ttk.Label(tab1, anchor="s", text="")
    bar_text.grid(column=1, row=7)

    create_plot_tab(tab2, tree_node, tree_edge)

    tab_control.pack(expand=2, fill='both')
    btn2 = ttk.Button(tab1,
                      text='Compute Network',
                      command=partial(clicked, sec_txt, combo_1, combo_2, bar,
                                      bar_text))
    btn2.grid(column=0, row=4, sticky='W')
    return window
        def Get():
            GetC = ThemedTk(theme=ttk_theme, themebg=True)
            frm = ttk.Frame(GetC)
            frm.pack(side=tk.LEFT, padx=20)

            treev = ttk.Treeview(frm,
                                 columns=(1),
                                 show="headings",
                                 height='30')
            treev.pack()
            treev.heading(1, text="Category Name")
            # GetC.geometry('250x600')
            GetC.title("Category List")
            GetC.resizable(False, False)
            db = sqlite3.connect('myspendmate.db')
            cursor = db.cursor()
            cursor.execute("select * from expenseCat")
            list1 = cursor.fetchall()
            total = cursor.rowcount

            for i in list1:
                treev.insert('', 'end', values=i)

            cursor.close()
            db.commit()
            db.close
            print(list1)
            GetC.mainloop()

            cursor.close()
            db.commit()
            db.close()
def main():
    def funcExit():
        message_box = messagebox.askquestion("Exit",
                                             "Do you want to exit?",
                                             icon='warning')
        if message_box == "yes":
            root.destroy()

    def funcAddBook():
        open_add_book = add_book.AddBook()

    def funcAddMember():
        open_add_member = add_member.AddMember()

    root = ThemedTk()
    root.get_themes()
    root.set_theme("arc")
    app = Main(root)

    #MenuBar
    menu_bar = Menu(root)
    root.config(menu=menu_bar)
    file = Menu(menu_bar, tearoff=0)
    menu_bar.add_cascade(label="File", menu=file)
    file.add_command(label="Add a Book", command=funcAddBook)
    file.add_command(label="Add a Member", command=funcAddMember)
    file.add_command(label="Show Member")
    file.add_command(label="Exit", command=funcExit)

    root.title("Library Management System")
    root.geometry("1280x720+450+150")
    root.resizable(False, False)
    root.iconbitmap("image/book_tk.ico")
    root.mainloop()
Beispiel #4
0
def main():
    if platform.system() != 'Linux':
        showerror('Error', 'Linux Is Required')
        return 1

    global window

    window = ThemedTk(theme='equilux', className='mcpil')
    window.title('MCPIL')
    window.geometry('512x400')
    window.resizable(True, True)

    tabs = ttk.Notebook(window)
    tabs.add(play_tab(tabs), text='Play')
    tabs.add(features_tab(tabs), text='Features')
    tabs.add(multiplayer_tab(tabs), text='Multiplayer')
    tabs.add(settings_tab(tabs), text='Settings')
    tabs.add(about_tab(tabs), text='About')
    tabs.pack(fill=BOTH, expand=True)

    load()
    save()

    window.wm_protocol('WM_DELETE_WINDOW', quit)
    signal.signal(signal.SIGINT, lambda *args: quit())

    try:
        window.mainloop()
    except KeyboardInterrupt:
        quit()

    return 0
def summary():
    if run:
        window = ThemedTk(theme='arc')
        window.resizable(0,0)
        window.geometry('400x400')
        present_list = []

        title_name2 =ttk.Label(window , text = 'Attendance Summary' , font = ('Tw Cen MT',20) , style = "BW.TLabel").place(x = 75 , y = 0)

        for i in range(2,sheet.max_row):
            if sheet.cell(row = i , column = req_column).value == 'P':
                name = sheet.cell(row = i , column = 1).value
                present_list.append(name)

        info = ttk.Label(window, text = str(len(present_list))+'/'+str(sheet.max_row-1)+' students are present' , font = ('Tw Cen MT',12)).place(x = 0 , y = 50)
        progressbar = ttk.Progressbar(window , orient = VERTICAL,length = 220, value = (len(present_list)/(sheet.max_row-1))*100 ).place(x = 340 , y = 50)
        percent = round(len(present_list)/(sheet.max_row-1)*100, 2)
        percent_label = ttk.Label(window, text ='{}%\npresence'.format(percent) ).place(x = 340, y = 290)

        for x in range(0,len(present_list)):
            lmain_x = ttk.Label(window, text = str(x+1)+'. '+present_list[x], font = ('Tw Cen MT',12)).place(x=0, y=(80 + x*25))

        backBtn = ttk.Button(window, text='Return', command=window.destroy).place(x = 280 , y = 350)


        window.mainloop()
    else:
        messagebox.showinfo('Error','There\'s nothing to show yet!')
Beispiel #6
0
def main():

    create_db_table()
    root = ThemedTk(theme='arc')
    root.title('AdventureGame')
    root.resizable(False, False)
    app = Application(master=root)
    app.mainloop()
Beispiel #7
0
def Retroalimentacion():
    #----------------------------------------Invocando al set que tengamos-------------------------------------
    PyMe1 = np.random.random_sample((1, 5))
    tienda_real = pd.read_csv("tienda_real.csv").apply(pd.to_numeric,
                                                       errors='coerce')
    retro = Graf_Retro(tienda_real.values)

    if retro < 0:
        retro *= -1
        retro1 = "La empresa está por debajo del promedio en un {0:.2f}".format(
            retro), "%"
    else:
        retro1 = "La empresa está por arriba del promedio en un {0:.2f}".format(
            retro), "%"

    if retro <= 25:
        retro2 = "Te recomendamos administrar un poco más tus gastos, los numeros obtenidos no son malos, pero a traves del flujo de inversión podrían mejorar bastante"
    if retro <= 50 and retro >= 26:
        retro2 = "Los números obtenidos tienen un porcentaje bajo, recomendamos cambiar estrategia de venta o inversión, para mayor informacón asistir a sucursal."
    if retro <= 100 and retro >= 51:
        retro2 = "Los ingresos y egresos de tu empresa son numeros muertos, en BBVA te ofrecemos un plan de mejora con posibles resultados a corto plazo, te recomendamos asistir a sucursal o llamar vía telefónica de inmediato."

    raiz2 = ThemedTk(theme='equilux')
    raiz2.resizable(0, 0)
    raiz2.title('Retroalimentación')

    miFrame2 = Frame(raiz2)
    miFrame2.pack(expand=1, fill=BOTH)

    #Nombre del recuadro grande
    cuadroRecomendacionLabel = Label(miFrame2,
                                     text='Retroalmentación: ',
                                     font=('Times', 15, 'bold')).grid(row=1,
                                                                      column=0,
                                                                      pady=5,
                                                                      padx=0)
    cuadroRecomendacion = Text(miFrame2, width=42, height=10, bg='grey')
    cuadroRecomendacion.grid(row=2,
                             column=0,
                             padx=20,
                             pady=5,
                             columnspan=2,
                             rowspan=7)
    cuadroRecomendacion.config(state=DISABLED)
    #Scroll del recuadro grande
    scrolly = Scrollbar(miFrame2, command=TextoLargo.yview)
    scrolly.grid(row=2, column=2, sticky='nsew')
    cuadroRecomendacion.config(yscrollcommand=scrolly.set)

    cuadroRecomendacion.config(state='normal')
    cuadroRecomendacion.insert(END, retro1[0])
    cuadroRecomendacion.insert(END, '\n')
    cuadroRecomendacion.insert(END, retro2)
    cuadroRecomendacion.config(state='disabled')

    raiz2.mainloop()
def edit():
    tctzn=StringVar()
    nsc = ThemedTk(theme="arc")
    nsc=tk.Toplevel()
    nsc.title("voter_list")
    nsc.geometry("400x300")
    nsc.resizable(False,False)
    nsc.iconbitmap("gov2.ico")
    l1=ttk.Label(nsc,text="Enter Citizenship Number or Voter ID:")
    ectzn = Entry(nsc,textvariable=tctzn)
    l1.place(relx=0.05,rely=0.5)
    ectzn.place(relx=0.559, rely=0.49)

    def sreh(*args):
        global vid
        flag=""
        c = sqlite3.connect("voterlist.db", check_same_thread=False)
        tc = c.execute("SELECT usr,pw,eml,phon,cou,gen,dob,ph,cid,vid,vtsta from voterlist")
        print(str(tctzn.get()))
        print("dfd")
        i=0
        for item in tc:
            if str(item[8]) == str(tctzn.get()) or str(item[9]) == str(tctzn.get()):
                flag="True"
                l1.destroy()
                ectzn.destroy()
                b1.destroy()
                la = ttk.Label(nsc)
                la["text"] = "Information is:\n" + "Name:" + str(item[0]) + "\nPhone Number: " + str(
                    item[3]) + "\nDate of birth: " + str(item[6]) + "\nEmail: " + str(
                    item[2]) + "\nVote Status: " + str(item[10])
                la.place(relx=0.01, rely=0.1)
                vid = (int(item[9]),)

                def dele():
                    global vid
                    print(vid)
                    tc = sqlite3.connect("voterlist.db", check_same_thread=False)
                    tc.execute("""DELETE FROM voterlist  WHERE vid=(?)""", vid)
                    tc.commit()
                    tc.close()
                    la.destroy()
                    messagebox.showinfo(message="Information deleted !")
                    nsc.destroy()

                bu1 = ttk.Button(nsc, text="Delete", command=dele)
                bu1.place(relx=0.6, rely=0.58)
                bu2 = ttk.Button(nsc, text="Back", command=sreh)
                bu2.place(relx=0.32, rely=0.58)
        if flag!="True":
            messagebox.showinfo(message="No match found!")
            nsc.destroy()

    b1 = ttk.Button(nsc, text="Search", command=lambda:sreh(tctzn.get()))
    b1.place(relx=0.6, rely=0.58)
    nsc.mainloop()
    def setCurrency():
        print("Set Currency here!")
        Currency = ThemedTk(theme=ttk_theme, themebg=True)
        Currency.resizable(False, False)
        # Currency.geometry('250x100')
        Currency.title("Set Currency")

        labelframe3 = ttk.LabelFrame(Currency, text="Expense")
        labelframe3.grid(row=1,column = 6, rowspan = 2, columnspan=2, sticky='WE', \
                padx=30, pady=30, ipadx=30, ipady=30)

        rootlabel = ttk.Label(labelframe3, text="Categories Details")
        rootlabel.grid()

        label_1 = ttk.Label(labelframe3,
                            text="Select Currency here",
                            width=20,
                            font=("bold", 10))
        label_1.grid(row=0, column=1, pady=2)

        country_list = ["INR", "USD", "CAD", "CNY", "DKK", "EUR"]
        Symbol = ["₹", "$", "$", "¥", "kr", "€"]

        cb = ttk.Combobox(labelframe3, values=country_list, width=10)
        cb.grid(row=1, column=1, pady=2)
        cb.current(0)

        def SaveCurrency():
            getCountry = cb.get()
            index = country_list.index(str(getCountry))
            db = sqlite3.connect('myspendmate.db')
            cursor = db.cursor()
            cursor.execute("select * from Currency")
            PreviousCurr = str(cursor.fetchone()[0])
            Latest = (Symbol[index])
            cursor.execute("update Currency set Symbol=? where Symbol=?",
                           (Latest, PreviousCurr))
            cursor.close()
            db.commit()
            db.close()
            Currency.destroy()
            messagebox.showinfo("Message", "Operation Successful!")
            callbalance(root)
            callincome(root)
            callExpense(root)
            callBudget(root)

        savebutton = ttk.Button(labelframe3,
                                text='Save and Exit',
                                command=SaveCurrency)
        savebutton.grid(row=2, column=1, pady=2)
    def show_signup_window(self):
        root = ThemedTk(theme=self.STYLE)
        root.geometry("400x250")
        root.title('Signup')
        root.resizable(0,0)

        # title
        ttk.Label(root, font=('default', 19, 'bold'), text='******Moriarity Point******').grid(row=0, column=0, sticky='w', padx=15)
        ttk.Separator(root, orient='horizontal').grid(row=1, columnspan=2, sticky='ew')

        # sub title
        ttk.Label(root, font=('default', 14, 'bold'), text='Add a new employee').grid(row=2, column=0, sticky='w', padx=5, pady=10)
        
        # defs
        def show_login():
            root.destroy()
            self.show_login_window()

        def signup_db():
            conn = sqlite3.connect('user.db')
            if not var_pass.get()==var_repass.get():
                messagebox.showwarning('Warning!', 'Passwords do not match.')
                return
            try:
                query = "INSERT INTO user_accounts(name, password) VALUES ( '{var_user.get()}', '{var_pass.get()}' )"
                
                conn.execute(query)
                conn.commit()
                messagebox.showinfo('Success!', 'User account for %s successfuly created!'%var_user.get())
                show_login()
            except:
                messagebox.showerror('Error!', 'There was an unexpected error!')

        PADX, PADY = 5, 5
        # signup form
        ttk.Label(root, text='Username:'******'w', padx=PADX, pady=PADY)
        ttk.Label(root, text='Password:'******'w', padx=PADX, pady=PADY)
        ttk.Label(root, text='Re-Password:'******'w', padx=PADX, pady=PADY)
        

        var_user, var_pass, var_repass = StringVar(), StringVar(), StringVar()
        ttk.Entry(root, textvariable=var_user, width=25).grid(row=3, column=0, sticky='e', padx=PADX, pady=PADY)
        ttk.Entry(root, textvariable=var_pass, width=25).grid(row=4, column=0, sticky='e', padx=PADX, pady=PADY)
        ttk.Entry(root, textvariable=var_repass, width=25).grid(row=5, column=0, sticky='e', padx=PADX, pady=PADY)
        

        ttk.Button(root, text='Signup', command=signup_db).grid(row=8, column=0, sticky='e', padx=PADX, pady=PADY)
        ttk.Button(root, text='Login', command=show_login).grid(row=8, column=0, sticky='w', padx=PADX, pady=PADY)

        root.mainloop()
def start(func, kol, speed, values=None, color_scheme="dracula"):
    root_main = ThemedTk()
    root_main.iconbitmap('icon.ico')
    root_main.title("Vizulization")
    root_main.set_theme('equilux')
    height = root_main.winfo_screenheight() - 300
    width = root_main.winfo_screenwidth() - 300
    root_main.geometry(
        '{}x{}+{}+{}'.format(width, height, (root_main.winfo_screenwidth() - width) // 2,
                             (root_main.winfo_screenheight() - height) // 2))
    root_main.resizable(False, False)
    if values:
        kol = len(values)
    func(width, height, kol, name=root_main, color_scheme=color_scheme, speed=speed, values=values).sort()
    root_main.mainloop()
Beispiel #12
0
def CORE(S,M,f,port="z11",RS=0,RL=oo):

    Bode(fraction(f)[0], fraction(f)[1],port,fraction(f)[0],fraction(f)[1])

    if S==0:
        caer1(f,port=port,RS=RS,RL=RL)
    elif S==M: 
        caer2(f,port=port,RS=RS,RL=RL) 
    else: 
        bias={"type":"w","label":"unkw","dirrection":"right","parallel":False}
        print("solution one for",f)
        Append("solution one for "+str(f))    
        s1=caer1(f,repeat=abs(S-M))
        s2=caer2(s1[2],gener=s1[1],repeat=S)
        s1[0].append(bias)
        for i in s2[0]:
            s1[0].append(i)
        #draw(s1[0],port,RS,RL)
        Append(40*"- ")
        ans1=s1[0]
        print("\n","solution two for",f)
        Append("solution two for "+str(f))  
        s2=caer2(f,repeat=S)
        s1=caer1(s2[2],gener=s2[1],repeat=abs(S-M))
        s2[0].append(bias)
        for i in s1[0]:
            s2[0].append(i)
        Append("",finish=True)
        #draw(s2[0],port=port,rs=RS,rl=RL)
        window =ThemedTk(theme="adapta")
        window.title('Please choose to plot')
        window.rowconfigure([0,1], weight=1)
        window.columnconfigure([0], weight=1)
        label = ttk.Label(window,text='For any solution you can draw a schematic',anchor=tk.CENTER)
        label.grid(row=0,column=0,sticky=tk.N+tk.S+tk.E+tk.W)
        card_frame = ttk.Frame(window)
        card_frame.grid(row=1, column=0, sticky=tk.N+tk.S+tk.E+tk.W)
        card_frame.rowconfigure([0], weight=1)
        card_frame.columnconfigure([0,1], weight=1)
        solution1 = ttk.Button(card_frame,text="plot solution one",width=15,
                            command=lambda: draw(ans1,port,RS,RL))
        solution1.grid(row=0, column=0, sticky=tk.N+tk.S+tk.E+tk.W)
        solution2 = ttk.Button(card_frame,text="plot solution two",width=15,
                            command=lambda: draw(s2[0],port,RS,RL))
        solution2.grid(row=0, column=1, sticky=tk.N+tk.S+tk.E+tk.W)
        window.resizable(width=False, height=False)
        window.deiconify()
        window.mainloop()
Beispiel #13
0
    def classic_button_function(self):
        self.exit_button_function()

        root = ThemedTk(theme=self.THEME)
        root.title(APPNAME)
        ws = root.winfo_screenwidth() / 2
        hs = root.winfo_screenheight() / 2
        root.geometry('%dx%d+%d+%d' % (580, 614, ws - 290, hs - 307))
        root.resizable(0, 0)


        game = PvAI_Game(Board(), Strategies.Minimax(2, Player.BLACK, Player.WHITE), root, width=592, height=618)
        game.pack(side="top", fill="both", expand="true")
        game.draw_pieces()

        root.mainloop()
Beispiel #14
0
class FrontEnd:
    APP_WIDTH = 400
    APP_HEIGHT = 450
    PROJECT_PATH = os.getcwd()

    def __init__(self, inputs, main_script):
        self.root = ThemedTk(theme="equilux")
        self.root.geometry(f"{self.APP_WIDTH}x{self.APP_HEIGHT}")
        self.root.resizable(False, False)
        self.root.title('Gui Scripter')
        icon = ImageTk.PhotoImage(
            Image.open(os.path.join(self.PROJECT_PATH, 'static/rob_icon.png')))
        self.root.iconphoto(False, icon)

        self.app_frame = ttk.Frame(self.root,
                                   width=self.APP_WIDTH,
                                   height=self.APP_HEIGHT)
        self.app_frame.pack(expand=True, fill='both')

        main_image = ImageTk.PhotoImage(
            Image.open(os.path.join(self.PROJECT_PATH, 'static/rob.png')))
        panel = tk.Label(self.app_frame, image=main_image, bg='#464646')
        panel.pack()

        self.inputs_dict = {}
        self.label_dict = {}
        for input_name in inputs:
            self.inputs_dict[input_name] = ttk.Entry(self.app_frame)
            self.label_dict[input_name] = ttk.Label(self.app_frame,
                                                    text=input_name)
            self.label_dict[input_name].pack(anchor='center')
            self.inputs_dict[input_name].pack(anchor='center', pady=2)

        self.run_script_button = ttk.Button(self.app_frame,
                                            text="Run !",
                                            command=main_script,
                                            takefocus=0)
        self.run_script_button.pack(anchor='center', pady=15)

        self.progress_bar = ttk.Progressbar(self.app_frame,
                                            orient="horizontal",
                                            length=self.APP_WIDTH - 100,
                                            mode='determinate')
        self.progress_bar.pack(side='top', padx=0, pady=35, anchor='n')

        self.root.mainloop()
    def show_login_window(self):
        root = ThemedTk(theme=self.STYLE)
        root.geometry("400x250")
        root.title('Login')
        root.resizable(0,0)

        # title
        ttk.Label(root, font=('default', 19, 'bold'), text='*******Moriarity Point******').grid(row=0, column=0, sticky='w', padx=15)
        ttk.Separator(root, orient='horizontal').grid(row=1, columnspan=2, sticky='ew')

        # sub title
        ttk.Label(root, font=('default', 14, 'bold'), text='Admin Login').grid(row=2, column=0, sticky='w', padx=5, pady=10)

        def show_signup():
            root.destroy()
            self.show_signup_window()
        
        def login_db():
            conn = sqlite3.connect('user.db')
            p=var_user.get()
            query =conn.execute("SELECT password FROM user_accounts WHERE name='"+p+"'")
            for row in query:
                   id= row[0]
            if id==int(var_pass.get()):
                m=messagebox.askyesno('Success!', 'User logged in! Continue to make your orders')
                if m>0:
                    root.destroy()
                    import restaurantmangement
                    
            else:
                messagebox.showerror('Error!', 'Username or password does not match!')
                

        PADX,PADY=5,5
        # login form
        ttk.Label(root, text='Username:'******'w', padx=PADX, pady=PADY)
        ttk.Label(root, text='Password:'******'w', padx=PADX, pady=PADY)

        var_user, var_pass = StringVar(), StringVar()
        ttk.Entry(root, textvariable=var_user, width=25).grid(row=3, column=0, sticky='e', padx=PADX, pady=PADY)
        ttk.Entry(root, textvariable=var_pass, width=25).grid(row=4, column=0, sticky='e', padx=PADX, pady=PADY)

        ttk.Button(root, text='Signup', command=show_signup).grid(row=5, column=0, sticky='w', padx=PADX, pady=PADY)
        ttk.Button(root, text='Login', command=login_db).grid(row=5, column=0, sticky='e', padx=PADX, pady=PADY)
        root.mainloop()
class MainPage(MainpageView):
    def __init__(self):
        """Window with main frame"""
        self.mainpage = ThemedTk()

        screen_width = self.mainpage.winfo_screenwidth()
        screen_height = self.mainpage.winfo_screenheight()

        self.mainpage.geometry(f'+{screen_width//4}+{screen_height//4}')

        self.mainpage.resizable(0, 0)
        self.mainframe = ttk.LabelFrame(self.mainpage)
        self.mainframe.pack(fill=tk.BOTH, expand=1)

        #Notebook
        self.notebook = ttk.Notebook(self.mainframe)
        self.notebook.pack(side='left', anchor=tk.N)

    def add_notebooks(self):
        """For adding notebooks"""
        #Adding record frame
        self.frame_add = ttk.Frame(self.mainframe)
        self.notebook.add(self.frame_add, text='Add record')
        super().add_Frame()

        #Searching record frame
        self.frame_search = ttk.Frame(self.mainframe)
        self.notebook.add(self.frame_search, text='Search record')
        super().search_Frame()

        #Editing record frame
        self.frame_edit = ttk.Frame(self.mainframe)
        self.notebook.add(self.frame_edit, text='Edit record')
        super().edit_Frame()

        #Deleting record frame
        self.frame_delete = ttk.Frame(self.mainframe)
        self.notebook.add(self.frame_delete, text='Delete record')
        super().delete_Frame()

        #Setting theme frame
        self.frame_theme = ttk.Frame(self.mainframe)
        self.notebook.add(self.frame_theme, text='Select theme')
        super().theme_Frame()
Beispiel #17
0
def main():
    global LARGE_FONT, realpositive, port
    LARGE_FONT = ("Verdana", 12)
    x, y = 648, 520
    #root = tk.Tk()
    root = ThemedTk(theme="adapta")
    realpositive = tk.IntVar()
    port = tk.StringVar()
    global startpage, synthesis, darlington, pageThree, transferFunction
    startpage = tk.Frame(root)
    synthesis = tk.Frame(root)
    darlington = tk.Frame(root)
    pageThree = tk.Frame(root)
    transferFunction = tk.Frame(root)
    for frame in (startpage, synthesis, darlington, pageThree,
                  transferFunction):
        frame.grid(row=0, column=0, sticky='news')
    StartPage()
    Synthesisframe()
    Darlingtonframe()
    PageThreeframe()
    TransferFunctionframe()
    root.update_idletasks()  # Update "requested size" from geometry manager
    a, a0 = str(x), x / 2
    b, b0 = str(y), y / 2
    root.geometry("+%d+%d" % ((root.winfo_screenwidth() / 2) - a0,
                              (root.winfo_screenheight() / 3) - b0))
    root.deiconify()
    root.resizable(width=False, height=False)
    menubar = tk.Menu(root)
    filemenu = tk.Menu(menubar, tearoff=0)
    filemenu.add_command(label="Tutorial", command=toturial)
    filemenu.add_command(label="About", command=About)
    filemenu.add_command(label="Exit", command=root.destroy)
    menubar.add_cascade(label="MENU", menu=filemenu)
    root.config(menu=menubar)
    root.title("LC & RC Filter")
    root.bind('<Escape>', lambda e: root.destroy())
    root.protocol("WM_DELETE_WINDOW", root.iconify)
    raise_frame(startpage)
    root.mainloop()
Beispiel #18
0
    def developer_verify(self, e):
        dev_verify_win = ThemedTk(theme='breeze')
        dev_verify_win.resizable(False, False)
        dev_verify_win.title('Dev Login')

        dev_key_label = ttk.Label(dev_verify_win, text='Dev Key:')
        dev_pass_label = ttk.Label(dev_verify_win, text='Password:'******'\u25CF', width=30)

        cancel_button = ttk.Button(dev_verify_win,
                                   text='Cancel',
                                   command=dev_verify_win.destroy)
        OK_button = ttk.Button(
            dev_verify_win,
            text='OK',
            command=lambda: self.dev_verify_second(dev_key_input.get(
            ), dev_pass_input.get(), dev_verify_win))

        dev_key_label.grid(row=0, column=0, padx=10, pady=(10, 0))
        dev_pass_label.grid(row=1, column=0, padx=10, pady=(5, 10))

        dev_key_input.grid(row=0,
                           column=1,
                           columnspan=2,
                           padx=10,
                           pady=(10, 0))
        dev_pass_input.grid(row=1,
                            column=1,
                            columnspan=2,
                            padx=10,
                            pady=(5, 10))

        cancel_button.grid(row=2, column=1, sticky=E, pady=(0, 10))
        OK_button.grid(row=2, column=2, sticky=E, pady=(0, 10), padx=(0, 10))

        dev_verify_win.mainloop()
        def AddCategories():
            Ac = ThemedTk(theme=ttk_theme, themebg=True)
            # Ac.geometry('250x150')
            Ac.resizable(False, False)
            Ac.title('Add Categories')

            labelframe2 = ttk.LabelFrame(Ac, text="Add Category")
            labelframe2.grid(row=1,column = 3, rowspan = 2, columnspan=2, sticky='WE', \
                    padx=30, pady=30, ipadx=30, ipady=30)

            label_1 = ttk.Label(labelframe2,
                                text="Enter Category Name",
                                width=20,
                                font=("bold", 10))
            label_1.grid()

            entry_1 = Entry(labelframe2, bd=5)
            entry_1.grid()

            def addCat():
                s = entry_1.get()
                db = sqlite3.connect('myspendmate.db')
                cursor = db.cursor()
                cursor.execute("insert into incomeCat values('%s')" % (s))
                cursor.close()
                db.commit()
                db.close()
                Acexit()

            def Acexit():
                Ac.destroy()

            savebutton = ttk.Button(labelframe2,
                                    text='Save and Exit',
                                    command=addCat)
            savebutton.grid()
Beispiel #20
0
    def menuPage(self):
        self.clearFrame()
        try:
            mainWin.unbind('<Return>',self.bind_id)
        except TclError:
            pass

        self.signUpButton = ttk.Button(self.mainFrame, text='Sign Up', style='TButton', command=self.signUpPage, width=15)
        self.signUpButton.grid(row=1, column=1, padx=5, pady=5, sticky=W+E+N+S)

        self.loginButton = ttk.Button(self.mainFrame, text='Log in', style='TButton', command=self.loginPage, width=15)
        self.loginButton.grid(row=2, column=1, padx=5, pady=5, sticky=W+E+N+S)

        self.adminButton = ttk.Button(self.mainFrame, text='Admin Mode', style='TButton', command=lambda:[self.admin(), self.loginPage()], width=15)
        self.adminButton.grid(row=3, column=1, padx=5, pady=5, sticky=W+E+N+S)

        self.quit = ttk.Button(self.mainFrame, text='Quit', style='S.TButton', command=self.destroy, width=4)
        self.quit.grid(row=4, column=1, padx=5, pady=20, sticky=N+S)

        self.lSpace = ttk.Label(self.mainFrame, width=8)
        self.lSpace.grid(row=0, column=0, pady=35)

        self.rSpace = ttk.Label(self.mainFrame, width=1)
        self.rSpace.grid(row=5, column=3, pady=0)

mainWin = ThemedTk(theme='arc')
mainWin.resizable(False,False)
mainWin.geometry('500x500+200+150')
atm(mainWin)
mainWin.mainloop()
Beispiel #21
0
        asset = repo.get_latest_release().get_assets()[1]
        response = gh_session.get(asset.url, stream=True, headers=headers)
        save_to = Path.home() / 'Downloads' / asset.name
        save_to.write_bytes(response.content)
        subprocess.Popen([save_to], shell=True)
    except Exception:
        print("Fichier github_id absent")


if __name__ == '__main__':
    MIN_WIDTH: int = 400
    MIN_HEIGHT: int = 150

    window = ThemedTk(theme='plastik')  # arc, breeze, plastik, clearlooks, black, equilux
    window.title('Utilitaires TMA')
    window.resizable(False, False)

    # Personnalisation Style
    style = Style(window)
    original_font = font.nametofont(style.lookup("TLabel", "font"))
    f = font.Font(**original_font.configure())
    f.configure(weight='bold', underline=0, size=9)
    style.configure('H1.TLabel', font=f)
    original_font = font.nametofont(style.lookup("TButton", "font"))

    f2 = font.Font(**original_font.configure())
    f2.configure(weight='bold', size=9)
    style.configure('H1.TButton', font=f2)

    window.grid_columnconfigure(0, weight=1)
    window.grid_rowconfigure(0, weight=1)
from tkinter import *
from tkinter import ttk
from tkinter import messagebox as msg
from tooltips_2 import CreateToolTip
from ttkthemes import ThemedTk, THEMES
from PIL import Image
from pytesseract import pytesseract
import os

root = ThemedTk(themebg=True)
root.set_theme('plastik')
root.title('Extract text from image')
root.iconbitmap('D:/python_dars/coding.ico')
root.geometry('500x300+300+200')
root.resizable(False, False)

path_to_tesseract = r"C:\Program Files\Tesseract-OCR\tesseract.exe"


def limitsize(*args):
    length = len(kirit.get())
    ga = kirit.index(INSERT)
    if length > 100:
        ending = kirit.index(END)
    if length > 100 and ga != ending:
        msg.showwarning(
            'Ogohlantirish',
            'Buncha ko\'p nomli faylning manzili bo\'lmaydi!Iltimos qisqa faylning manzilini kiriting@'
        )
        ga_1 = kirit.index(INSERT)
        kirit.delete(ga_1, ga_1 + 1)
Beispiel #23
0
    def AddExpense():
        expense = ThemedTk(theme=ttk_theme, themebg=True)
        expense.title("Add Expense")
        expense.resizable(False, False)
        labelframe_2 = ttk.LabelFrame(expense, text="Add Expense Entry")
        labelframe_2.grid(row=1,column = 2, rowspan = 6, columnspan=4, sticky='WE', \
                padx=30, pady=30, ipadx=30, ipady=30)

        rootlabel = ttk.Label(labelframe_2,
                              text="Enter the following fields ",
                              width=30,
                              font=("bold", 10))
        rootlabel.grid(row=2, column=0, columnspan=4, padx=10, pady=4)

        label_1 = ttk.Label(labelframe_2,
                            text="Enter Amount ",
                            width=30,
                            font=("bold", 10))
        label_1.grid(row=3, column=0, columnspan=4, pady=4)

        entry_1 = Entry(labelframe_2, bd=5)
        entry_1.grid(row=3, column=4, pady=4)

        def printamount():
            s = entry_1.get()
            if s.isdigit():
                print('Amount: ' + s)
                return s
            else:
                messagebox.showinfo(
                    "Attention!",
                    "Amount Should be a number and not text or any Special Character!\nEntry Not Saved. Try Again!"
                )
                entry_1.delete(0, END)
                entry_1.insert(0, "")
                return "stop"

        label_2 = ttk.Label(labelframe_2,
                            text="Select Date",
                            width=30,
                            font=("bold", 10))
        label_2.grid(row=4, column=0, columnspan=4, pady=4)

        def dateSelector():
            def print_sel():
                global date_selected
                dateselected = cal.selection_get()
                date_selected = dateselected
                print(dateselected)
                labelstatus = ttk.Label(top,
                                        text="****Close this window.",
                                        width=20,
                                        font=("bold", 12)).grid(column=0)
                label_3 = ttk.Label(labelframe_2,
                                    text=dateselected,
                                    width=30,
                                    font=("bold", 10))
                label_3.grid(row=4, column=6, pady=4)
                top.destroy()
                # cal.see(datetime.date(year=2020, month=2, day=5))
                return dateselected

            top = Toplevel(expense)
            # top.geometry('500x500')
            import datetime
            today = datetime.date.today()

            mindate = datetime.date(year=2000, month=1, day=1)
            maxdate = today + datetime.timedelta(days=5)
            # print(mindate, maxdate)

            cal = Calendar(top,
                           font="Arial 14",
                           selectmode='day',
                           locale='en_US',
                           mindate=mindate,
                           maxdate=maxdate,
                           disabledforeground='red',
                           cursor="hand1",
                           year=2020,
                           month=5,
                           day=5)
            # cal.pack(fill="both", expand=True)
            cal.grid()
            expensebtn2 = ttk.Button(top, text="Select",
                                     command=print_sel).grid()
            print("Date_new:" + str(date_selected))
            return date_selected
            # tk.top.destroy()

        incomebtn = ttk.Button(labelframe_2,
                               text='Enter Date',
                               command=dateSelector)
        incomebtn.grid(row=4, column=4, pady=4)

        label_1 = ttk.Label(labelframe_2,
                            text="Description (Max Char = 32)",
                            width=30,
                            font=("bold", 10))
        label_1.grid(row=5, column=0, columnspan=4, pady=4)

        entry_2 = Entry(labelframe_2, bd=5)
        entry_2.grid(row=5, column=4, pady=4)

        def printdescription():
            s2 = entry_2.get()
            print('Description: ' + s2)
            return s2

        label_1 = ttk.Label(labelframe_2,
                            text="Category",
                            width=30,
                            font=("bold", 10))
        label_1.grid(row=6, column=0, columnspan=4, pady=4)

        def printcategory():
            print('Category: ' + cb.get())
            return cb.get()

        db = sqlite3.connect('myspendmate.db')
        cursor = db.cursor()
        cursor.execute("select * from expenseCat")
        cat_list = cursor.fetchall()
        print("-------------incomeCat--------------")
        print(cat_list)
        Category = []
        for i in cat_list:
            Category.append(i[0])
        cb = ttk.Combobox(labelframe_2, values=Category, width=10)
        cb.grid(row=6, column=4, pady=4)
        cb.current(0)

        label_1 = ttk.Label(labelframe_2,
                            text="Account",
                            width=30,
                            font=("bold", 10))
        label_1.grid(row=7, column=0, columnspan=4, pady=10)

        def printaccount():
            print('Account: ' + accountbox.get())
            return accountbox.get()

        db = sqlite3.connect('myspendmate.db')
        cursor = db.cursor()
        cursor.execute("select * from Account")
        acc_list = cursor.fetchall()
        # print("-------------incomeCat--------------")
        # print(cat_list)
        Account = []
        for i in acc_list:
            Account.append(i[0])
        accountbox = ttk.Combobox(labelframe_2, values=Account, width=10)
        accountbox.grid(row=7, column=4, pady=10)
        accountbox.current(0)

        def put():
            t1 = printamount()
            if t1 == "stop":
                return "stopped"
            t2 = str(printdescription())
            t3 = str(printcategory())
            t4 = str(printaccount())
            t5 = str(date_selected)
            if date_selected == None:
                messagebox.showinfo(
                    "Attention!",
                    "Date Field Should be not be empty.\nEntry Not Saved.\nPlease Select the Date and Try Again!"
                )
                return "stopped"
            print('date selected' + str(t5))
            info = str(t5)
            day = info[8] + info[9]
            mon = info[5] + info[6]
            yr = info[0] + info[1] + info[2] + info[3]
            print('day ' + str(day))
            print('mon ' + str(mon))
            print('yr ' + str(yr))
            db = sqlite3.connect('myspendmate.db')
            cursor = db.cursor()
            cursor.execute(
                "insert into expense values('%d','%s','%s','%s','%s','%d','%d','%d')"
                % (int(t1), t5, t2, t3, t4, int(day), int(mon), int(yr)))
            cursor.execute("select sum(amount) from expense")
            sum1 = cursor.fetchone()[0]
            if (sum1 == 'None'):
                sum1 = str(0)
            rootlabel1.config(text=str(sum1) + CurrencyCurrent)
            cursor.close()
            db.commit()
            db.close
            callbalance(root)
            return "done"
            # callBudget(root)

        # label_1 = Label(expense, text="Payment Recieved?",width=20,font=("bold", 10))
        # label_1.place(x=60,y=360)
        def expenseexit():
            expense.destroy()

        def AllinOne():
            # put()
            status = put()
            # if status == "stopped":
            #     AllinOne()
            if status == "done":
                messagebox.showinfo("Success!!",
                                    "Expense Entry have been saved")
            print("After Expense Update Budget----------")
            callBudget(root)
            expenseexit()
            pass

        savebutton = ttk.Button(labelframe_2,
                                text='Save and Exit',
                                command=AllinOne)
        savebutton.grid(row=8, column=0, columnspan=6, pady=4)
from tkinter import *
import tkinter as tk
from tkinter import ttk
from ttkthemes import ThemedTk
import threading
import temp_ser
from tkinter import messagebox
import _tkinter
import time
import sqlite3
import base64
sc=ThemedTk(theme="arc")
sc.minsize(300,300)
sc.resizable(False,False)
sc.title("server_status")
sc.iconbitmap("gov2.ico")
l=Label(sc,font={"10"},fg="green")
i=0
global tctzn
tctzn=StringVar
def staser():
    def th():
        i=0
        t1=threading.Thread(target=temp_ser.main)
        t1.daemon=True
        t1.start()

        b2.destroy()
        b1 = ttk.Button(sc, text="Stop Server", command=ext)
        b1.place(relx=0.38, rely=0.3)
Beispiel #25
0
    #Scroll del recuadro grande
    scrolly = Scrollbar(miFrame2, command=TextoLargo.yview)
    scrolly.grid(row=2, column=2, sticky='nsew')
    cuadroRecomendacion.config(yscrollcommand=scrolly.set)

    cuadroRecomendacion.config(state='normal')
    cuadroRecomendacion.insert(END, retro1[0])
    cuadroRecomendacion.insert(END, '\n')
    cuadroRecomendacion.insert(END, retro2)
    cuadroRecomendacion.config(state='disabled')

    raiz2.mainloop()


raiz = ThemedTk(theme='equilux')
raiz.resizable(0, 0)
raiz.title('BBVA PyMe')

miFrame = Frame(raiz)
miFrame.pack(expand=1, fill=BOTH)

resultado = 0
dinero = []
Cantidad = StringVar()
Nombre = StringVar()
Resultado = StringVar()

#Crear cuadro para meter cantidades
nombreCantidad_L = Label(miFrame,
                         text='Cantidad: ',
                         font=('Times', 15, 'bold')).grid(row=0,
Beispiel #26
0
def get_weather(event=''):
    if entry.get():
        params = {
            'appid': API_KEY,
            'q': entry.get(),
            'units': 'metric',
            'lang': 'ru'
        }
    req = requests.get(API_URL, params=params)
    weather = req.json()
    lbl['text'] = print_weather(weather)


root = ThemedTk(theme='ark')
root.geometry('500x400+300+200')
root.resizable(0, 0)

s = ttk.Style()
s.configure('TLabel', padding=5, font='Arial 12')

top_frame = ttk.Frame(root)
top_frame.place(relx=0.5, rely=0.1, relwidth=0.9, relheight=0.1, anchor='n')

entry = ttk.Entry(top_frame)
entry.place(relwidth=0.7, relheight=1)
entry.bind('<Return>', get_weather)

btn = ttk.Button(top_frame, text='Запрос погоды', command=get_weather)
btn.place(relx=0.7, relwidth=0.3, relheight=1)

low_frame = ttk.Frame(root)
Beispiel #27
0
class UpdateBook_Frame:
    def do_updateBook(self):

        bookTools = BookTools()
        book = Book()

        author = Author()
        authorTools = AuthorTools()

        publisher = Publisher()
        publisherTools = PublisherTools()

        if (self.idBookEntry['text'] != None and self.idBookEntry['text'] != ""
                and self.nameBookEntry.get() != None
                and self.nameBookEntry.get() != ""
                and self.priceEntry.get() != None
                and self.priceEntry.get() != ""
                and self.typeEntry.get() != None and self.typeEntry.get() != ""
                and self.authorEntry.get() != None
                and self.authorEntry.get() != ""
                and self.publisherEntry.get() != None
                and self.publisherEntry.get() != ""
                and self.workplaceEntry.get() != None
                and self.workplaceEntry.get() != ""
                and self.addressEntry.get() != None
                and self.addressEntry.get() != ""):

            book.setIdBook(self.idBookEntry['text'])
            book.setNameBook(self.nameBookEntry.get())
            book.setPrice(self.priceEntry.get())
            book.setType(self.typeEntry.get())
            book.setAuthor(self.authorEntry.get())
            book.setPublisher(self.publisherEntry.get())

            author.setName(self.authorEntry.get())
            author.setWorkplace(self.workplaceEntry.get())

            publisher.setName(self.publisherEntry.get())
            publisher.setAddress(self.addressEntry.get())

            publisherTools.UpdatePublisher(publisher)
            publisherTools.addPublisher(publisher)

            authorTools.UpdateAuthor(author)
            authorTools.addAuthor(author)

            i = bookTools.UpdateBook(book)
            if i == 1:
                messagebox.showinfo("Sucessfully Update",
                                    "Sucessfully Update The Book Infomation")
                MsgBox = messagebox.askquestion(
                    'Continue',
                    'Are you sure you want to Continue',
                    icon='info')
                if MsgBox != 'yes':
                    self.root.destroy()
                return
            else:
                messagebox.showinfo("Failed to Update",
                                    "Failed to Update The Book Infomation")
                MsgBox = messagebox.askquestion(
                    'Continue',
                    'Are you sure you want to Continue',
                    icon='info')
                if MsgBox != 'yes':
                    self.root.destroy()
                return
        else:
            messagebox.showinfo("Please Enter the Infomation",
                                "Please Enter the Infomation")

    def __init__(self, Book_ManegementFrame):

        self.root = ThemedTk(theme="equilux")

        #Setting the Title
        self.root.title("Library Management System")

        #Setting the icon
        self.root.iconbitmap('src\\picture\\library.ico')

        #Get the screen resolution
        self.x = self.root.winfo_screenwidth()
        self.y = self.root.winfo_screenheight()

        #Get the value for windows size
        self.x1 = self.x * (4 / 9)
        self.y1 = self.y * (5 / 11)

        #Get the value for Starting point for windows
        self.x2 = self.x * (3 / 11)
        self.y2 = self.y * (2 / 9)

        self.root.geometry("%dx%d+%d+%d" %
                           (self.x1, self.y1, self.x2, self.y2))
        self.root.resizable(False, False)

        #Easy for configure within attribute
        self.x1 = int(self.x1)
        self.y1 = int(self.y1)

        #Setting Entry variable
        self.nameBook = StringVar()
        self.price = StringVar()
        self.type = StringVar()
        self.author = StringVar()
        self.workplace = StringVar()
        self.publisher = StringVar()
        self.address = StringVar()

        self.style = ttk.Style()
        self.style.configure("Title.TLabel", foreground="snow")
        self.style.configure("Nav.TButton",
                             font=("Cascadia Code SemiBold", 12))
        self.style.configure("Content.TFrame",
                             foreground="black",
                             background="LightSkyBlue2")
        self.style.configure("Content.TLabel",
                             foreground="black",
                             background="LightSkyBlue2")
        self.style.configure("Nav.TFrame",
                             foreground="black",
                             background="SeaGreen1")

        self.content_frame = ttk.Frame(self.root, style="Content.TFrame")
        self.content_frame.place(relwidth=1, relheight=1)

        self.idBookLabel = ttk.Label(self.content_frame,
                                     text="Book ID :",
                                     font=("Cascadia Code SemiBold", 12),
                                     style="Content.TLabel")
        self.idBookLabel.place(relx=0.3, rely=0.05)

        self.idBookEntry = ttk.Label(self.content_frame,
                                     text="%s" % Book_ManegementFrame.idbook,
                                     font=("Cascadia Code", 12),
                                     style="Content.TLabel")
        self.idBookEntry.place(relx=0.43, rely=0.05)

        self.nameBookLabel = ttk.Label(self.content_frame,
                                       text="Name :",
                                       font=("Cascadia Code SemiBold", 12),
                                       style="Content.TLabel")
        self.nameBookLabel.place(relx=0.34, rely=0.15)

        self.nameBookEntry = ttk.Entry(self.content_frame,
                                       font=("Cascadia Code", 12),
                                       textvariable=self.nameBook)
        self.nameBookEntry.place(relx=0.43, rely=0.15)

        self.priceLabel = ttk.Label(self.content_frame,
                                    text="Price :",
                                    font=("Cascadia Code SemiBold", 12),
                                    style="Content.TLabel")
        self.priceLabel.place(relx=0.327, rely=0.25)

        self.priceEntry = ttk.Entry(self.content_frame,
                                    font=("Cascadia Code", 12),
                                    textvariable=self.price)
        self.priceEntry.place(relx=0.43, rely=0.25)

        self.typeLabel = ttk.Label(self.content_frame,
                                   text="Type :",
                                   font=("Cascadia Code SemiBold", 12),
                                   style="Content.TLabel")
        self.typeLabel.place(relx=0.34, rely=0.35)

        self.typeEntry = ttk.Entry(self.content_frame,
                                   font=("Cascadia Code", 12),
                                   textvariable=self.type)
        self.typeEntry.place(relx=0.43, rely=0.35)

        self.authorLabel = ttk.Label(self.content_frame,
                                     text="Author :",
                                     font=("Cascadia Code SemiBold", 12),
                                     style="Content.TLabel")
        self.authorLabel.place(relx=0.15, rely=0.45)

        self.authorEntry = ttk.Entry(self.content_frame,
                                     font=("Cascadia Code", 12),
                                     textvariable=self.author)
        self.authorEntry.place(relx=0.26, rely=0.45, relwidth=0.2)

        self.workplaceLabel = ttk.Label(self.content_frame,
                                        text="Workplace :",
                                        font=("Cascadia Code SemiBold", 12),
                                        style="Content.TLabel")
        self.workplaceLabel.place(relx=0.5, rely=0.45)

        self.workplaceEntry = ttk.Entry(self.content_frame,
                                        font=("Cascadia Code", 12),
                                        textvariable=self.workplace)
        self.workplaceEntry.place(relx=0.65, rely=0.45, relwidth=0.2)

        self.publisherLabel = ttk.Label(self.content_frame,
                                        text="Publisher :",
                                        font=("Cascadia Code SemiBold", 12),
                                        style="Content.TLabel")
        self.publisherLabel.place(relx=0.11, rely=0.55)

        self.publisherEntry = ttk.Entry(self.content_frame,
                                        font=("Cascadia Code", 12),
                                        textvariable=self.publisher)
        self.publisherEntry.place(relx=0.26, rely=0.55, relwidth=0.2)

        self.addressLabel = ttk.Label(self.content_frame,
                                      text="Address :",
                                      font=("Cascadia Code SemiBold", 12),
                                      style="Content.TLabel")
        self.addressLabel.place(relx=0.528, rely=0.55)

        self.addressEntry = ttk.Entry(self.content_frame,
                                      font=("Cascadia Code SemiBold", 12),
                                      textvariable=self.address)
        self.addressEntry.place(relx=0.65, rely=0.55, relwidth=0.2)

        self.updateButton = ttk.Button(self.content_frame,
                                       text="Update",
                                       style="Nav.TButton")
        self.updateButton.place(relx=0.45, rely=0.7)

        self.root.mainloop()
Beispiel #28
0
class appli(Tk):

    def __init__(self):
        #         self.appli = Tk()
        self.appli = ThemedTk(theme="black")  # Thème black parce que c'est mieux
        self.appli.title("Méthodes de chiffrement")
        self.tabControl = ttk.Notebook(self.appli)

        self.initUI()

    def initUI(self):
        # Les frame onglets
        self.Introduction = ttk.Frame(self.tabControl)
        self.Polybe = ttk.Frame(self.tabControl)
        self.César = ttk.Frame(self.tabControl)
        self.Hill = ttk.Frame(self.tabControl)
        self.PlayFair = ttk.Frame(self.tabControl)
        self.Vigenère = ttk.Frame(self.tabControl)
        self.Homophone = ttk.Frame(self.tabControl)
        self.Atbash = ttk.Frame(self.tabControl)

        self.tabControl.add(self.Introduction, text='Introduction')
        self.tabControl.add(self.Polybe, text='Carré de Polybe')
        self.tabControl.add(self.Atbash, text='Atbash')
        self.tabControl.add(self.César, text='César')
        self.tabControl.add(self.Homophone, text='Homophone')
        self.tabControl.add(self.Hill, text='Hill')
        self.tabControl.add(self.PlayFair, text='PlayFair')
        self.tabControl.add(self.Vigenère, text='Vigenère')



        self.tabControl.pack(expand=1, fill="both")

        ###############
        # Onglets
        ###############
        # Onglet César
        ttk.Label(self.César, text="Chiffre de César")
        # Onglet Polybe
        ttk.Label(self.Polybe, text="Carré de Polybe")
        # Onglet Hill
        ttk.Label(self.Hill, text="Hill")
        # Onglet PlayFair
        ttk.Label(self.PlayFair, text="Méthode de PlayFair")
        # Onglet Vigenère
        ttk.Label(self.Vigenère, text="Chiffre de Vigenère")
        # Onglet Homophone avec carré de polybe
        ttk.Label(self.Homophone, text="Chiffrement Homophone avec carré de polybe")
        # Onglet Atbash
        ttk.Label(self.Atbash, text="Chiffre de Vigenère")


        # Onglet principal
        ttk.Label(self.Introduction, text="")

        ####################################
        # Onglet Introduction
        self.txt_intro = ttk.Label(self.Introduction,
                                   text="Cette application vous offre la possibilité de chiffrer et déchiffrer des messages \n avec différentes méthodes telles que :\n \n le chiffre de César, Hill, PlayFair, Vigenère, etc ... Bon amusement !!! \n Pour accéder aux différentes méthodes de chiffrement je vous invite à \n visiter les différents onglets disponibles ! \n Bon amusement ! \n Les imports obligatoires sont : - tkinter \n - ttk \n - Themedttk \n Leur installation préalable doit être effectuée sur votre IDE ! \n Merci et bon amusement !",
                                   #             foreground="#86d1f7",  # Set the text color
                                   #             background="#17008a"  # Set the background color
                                   )
        self.txt_intro.place(relx=0.2, rely=0.3)



        ####################################
        # Construction contenu onglet Polybe
        # Création Boutons
        self.btn_chiffrer_Polybe = Button(self.Polybe, text='Chiffrer', fg="blue", activebackground="blue", width=10,
                                          height=1, padx=10, pady=10, command=lambda: self.chiffrer_Polybe(self.ent_phrase_ Polybe.get(),
                                                                             self.ent_cle_Polybe.get()))
        self.btn_chiffrer_Polybe.place(relx=0.34, rely=0.3)
        self.btn_dechiffrer_Polybe = Button(self.Polybe, text='Déchiffrer', fg="blue", activebackground="blue",
                                            width=10,height=1, padx=10, pady=10, command=lambda: self.dechiffrer_Polybe(self.ent_phrase_Polybe.get(),
                                                                             self.ent_cle_Polybe.get()))
        self.btn_dechiffrer_Polybe.place(relx=0.53, rely=0.3)
        #
        ####################################
        ####################################
        # Création des zones de texte

        self.ent_phrase_Polybe = Entry(self.Polybe, width=50)
        self.ent_phrase_Polybe.place(relx=0.25, rely=0.1)
        self.ent_cle_Polybe = Entry(self.Polybe, width=50)
        self.ent_cle_Polybe.place(relx=0.25, rely=0.2)

        # Zone text_entry matrice
        self.txt_tab_polybe = Text(self.Polybe, width=35, height=5, padx=20, pady=10)
        self.txt_tab_polybe.place(relx=0.25, rely=0.4)

        # Labels zones de texte
        self.lbl_phrase_Polybe = Label(self.Polybe, text="Phrase à coder : ")
        self.lbl_phrase_Polybe.place(relx=0.05, rely=0.1)
        self.lbl_cle_Polybe = Label(self.Polybe, text="Clé de chiffrement : ")
        self.lbl_cle_Polybe.place(relx=0.05, rely=0.2)
        self.lbl_resultat = Label(self.Polybe, text="Résultat : ")
        self.lbl_resultat.place(relx=0.05, rely=0.6)
        self.lbl_tab_polybe = Label(self.Polybe, text="Affichage du carré : ")
        self.lbl_tab_polybe.place(relx= 0.05, rely = 0.4)

        # Texte Réponse
        self.txt_phrase_chiffre_Polybe = Text(self.Polybe, width=35, height=5, padx=20, pady=10)
        self.txt_phrase_chiffre_Polybe.place(relx=0.25, rely=0.6)
        #
        ####################################
        # Construction contenu onglet César

        ####################################
        # Création des zones de texte

        self.phrase_cesar_input = StringVar()
        self.cle_cesar_input = StringVar()

        self.ent_phrase_cesar = Entry(self.César, textvariable=self.phrase_cesar_input, width=50)
        self.ent_phrase_cesar.place(relx=0.25, rely=0.1)
        self.ent_cle_cesar = Entry(self.César, textvariable=self.cle_cesar_input, width=50)
        self.ent_cle_cesar.place(relx=0.25, rely=0.2)

        # Création Boutons
        self.btn_chiffrer_cesar = Button(self.César, text='Chiffrer', fg="blue",
                                         activebackground="blue", width=10, height=1, padx=10, pady=10,
                                         command=lambda: self.chiffrer_cesar(self.ent_phrase_cesar.get(),
                                                                             self.ent_cle_cesar.get()))
        self.btn_chiffrer_cesar.place(relx=0.34, rely=0.4)
        self.btn_dechiffrer_cesar = Button(self.César, text='Déchiffrer', fg="blue",
                                           activebackground="blue", width=10, height=1, padx=10, pady=10,
                                           command=lambda: self.dechiffrer_cesar(self.ent_phrase_cesar.get(),
                                                                                 self.ent_cle_cesar.get()))
        self.btn_dechiffrer_cesar.place(relx=0.53, rely=0.4)

        # def on_click(event):
        #     phrase_cesar = ent_phrase_cesar.get()
        #     cle_cesar= int(ent_cle_cesar.get())
        #     chiffrer_cesar(phrase_cesar, cle_cesar)

        # btn_chiffrer_cesar.bind("<Button-1>", on_click)

        #
        ####################################
        # Labels zones de texte
        self.lbl_phrase_cesar = Label(self.César, text="Phrase à coder")
        self.lbl_phrase_cesar.place(relx=0.05, rely=0.1)
        self.lbl_cle_cesar = Label(self.César, text="Clé de chiffrement")
        self.lbl_cle_cesar.place(relx=0.05, rely=0.2)

        # Texte Réponse
        self.txt_phrase_chiffre_cesar = Text(self.César, width=38, height=5)
        self.txt_phrase_chiffre_cesar.place(relx=0.25, rely=0.6)

        ####################################
        # Construction contenu onglet Hill
        # Création Boutons
        self.btn_chiffrer_Hill = Button(self.Hill, text='Chiffrer', fg="blue", activebackground="blue", width=10,
                                        height=1, padx=10, pady=10)
        self.btn_chiffrer_Hill.place(relx=0.34, rely=0.4)
        self.btn_dechiffrer_Hill = Button(self.Hill, text='Déchiffrer', fg="blue", activebackground="blue", width=10,
                                          height=1, padx=10, pady=10)
        self.btn_dechiffrer_Hill.place(relx=0.53, rely=0.4)
        #
        ####################################
        ####################################
        # Création des zones de texte

        self.ent_phrase_Hill = Entry(self.Hill, width=50)
        self.ent_phrase_Hill.place(relx=0.25, rely=0.1)
        self.ent_cle_Hill = Entry(self.Hill, width=50)
        self.ent_cle_Hill.place(relx=0.25, rely=0.2)

        # Zone text_entry matrice
        self.ent_matrix_1 = Entry(self.Hill, width=5)
        self.ent_matrix_1.place(relx=0.45, rely=0.30)
        self.ent_matrix_2 = Entry(self.Hill, width=5)
        self.ent_matrix_2.place(relx=0.45, rely=0.35)
        self.ent_matrix_3 = Entry(self.Hill, width=5)
        self.ent_matrix_3.place(relx=0.53, rely=0.30)
        self.ent_matrix_4 = Entry(self.Hill, width=5)
        self.ent_matrix_4.place(relx=0.53, rely=0.35)

        # Labels zones de texte
        self.lbl_phrase_Hill = Label(self.Hill, text="Phrase à coder")
        self.lbl_phrase_Hill.place(relx=0.05, rely=0.1)
        self.lbl_cle_Hill = Label(self.Hill, text="Clé de chiffrement")
        self.lbl_cle_Hill.place(relx=0.05, rely=0.2)

        # Texte Réponse
        self.txt_phrase_chiffre_Hill = Text(self.Hill, width=35, height=5, padx=20, pady=10)
        self.txt_phrase_chiffre_Hill.place(relx=0.25, rely=0.6)


        ####################################
        # Construction contenu onglet PlayFair
        ####################################
        #
        ####################################
        # Création des zones de texte

        self.phrase_PlayFair_input = StringVar()
        self.cle_PlayFair_input = StringVar()

        self.ent_phrase_PlayFair = Entry(self.PlayFair, textvariable=self.phrase_PlayFair_input, width=50)
        self.ent_phrase_PlayFair.place(relx=0.25, rely=0.1)
        self.ent_cle_PlayFair = Entry(self.PlayFair, textvariable=self.cle_PlayFair_input, width=50)
        self.ent_cle_PlayFair.place(relx=0.25, rely=0.2)

        # Création Boutons
        self.btn_chiffrer_PlayFair = Button(self.PlayFair, text='Chiffrer', fg="blue",
                                         activebackground="blue", width=10, height=1, padx=10, pady=10,
                                         command=lambda: self.chiffrer_PlayFair(self.ent_phrase_PlayFair.get(),
                                                                             self.ent_cle_PlayFair.get()))
        self.btn_chiffrer_PlayFair.place(relx=0.34, rely=0.6)
        self.btn_dechiffrer_PlayFair = Button(self.PlayFair, text='Déchiffrer', fg="blue",
                                           activebackground="blue", width=10, height=1, padx=10, pady=10,
                                           command=lambda: self.dechiffrer_PlayFair(self.ent_phrase_PlayFair.get(),
                                                                                 self.ent_cle_PlayFair.get()))
        self.btn_dechiffrer_PlayFair.place(relx=0.53, rely=0.6 )

        ####################################
        # Labels zones de texte
        self.lbl_phrase_PlayFair = Label(self.PlayFair, text="Phrase à coder")
        self.lbl_phrase_PlayFair.place(relx=0.05, rely=0.1)
        self.lbl_cle_PlayFair = Label(self.PlayFair, text="Clé de chiffrement")
        self.lbl_cle_PlayFair.place(relx=0.05, rely=0.2)



        # Texte Réponse
        self.txt_phrase_chiffre_PlayFair = Text(self.PlayFair, width=38, height=5)
        self.txt_phrase_chiffre_PlayFair.place(relx=0.25, rely=0.7)


        ####################################
        # Application principale
        ####################################
        self.appli.geometry("600x600+10+10")
        self.appli.resizable(0, 0)
        self.appli.mainloop()



########################################################################################################################
    ############################################
    # Définitions des fonctions de chiffrement #
    ###################################
    # Chiffrement de César

    def chiffrer_cesar(self, phrase_cesar, cle_cesar):
        print("Phrase = ", phrase_cesar)
        print("Cle = ", cle_cesar)
        cle_cesar = int(cle_cesar)
        txt_achiffrer_cesar = phrase_cesar.upper()
        lg = len(txt_achiffrer_cesar)
        txt_msg_chiffre_cesar = ""

        for i in range(lg):
            if (ord(txt_achiffrer_cesar[i]) > 90 or ord(txt_achiffrer_cesar[i]) < 65):
                txt_msg_chiffre_cesar += txt_achiffrer_cesar[i]
            else:
                asc = ord(txt_achiffrer_cesar[i]) + cle_cesar
                txt_msg_chiffre_cesar += chr(asc + 26 * ((asc < 65) - (asc > 90)))

        print("Message codé      :", txt_msg_chiffre_cesar)
        self.txt_phrase_chiffre_cesar.delete(1.0, "end") #Efface l'ancien résulat de chiffrement/déchiffrement
        self.txt_phrase_chiffre_cesar.insert(1.0, txt_msg_chiffre_cesar) #Ecriture du résultat  de chiffrement/déchiffrement dans la zone de texte

    #
    ####################################

    def dechiffrer_cesar(self, phrase_cesar, cle_cesar):
        # cle=22 # Décalage par rapport à Y (code ASCII : 22 + 1 = 23e lettre de l'alphabet)
        # cle_cesar = int(input("Quelle est la clé pour le déchiffrement?")) #Code pour lancement console

        # phrase_cesar = str(input("Quelle est le message à déchiffrer ?"))
        print("Phrase = ", phrase_cesar)
        print("Cle = ", cle_cesar)
        cle_cesar = int(cle_cesar)
        txt_achiffrer_cesar = phrase_cesar.upper()
        lg = len(txt_achiffrer_cesar)
        MessageClair = ""

        for i in range(lg):
            if ((ord(txt_achiffrer_cesar[i]) > 90 or ord(txt_achiffrer_cesar[i]) < 65)):
                MessageClair += txt_achiffrer_cesar[i]
            else:
                asc = ord(txt_achiffrer_cesar[i]) - cle_cesar
                MessageClair += chr(asc + 26 * ((asc < 65) - (asc > 90)))

        print("Message décodé : ", MessageClair)
        self.txt_phrase_chiffre_cesar.delete(1.0, "end")
        self.txt_phrase_chiffre_cesar.insert(1.0, MessageClair)
Beispiel #29
0
class MainGUI:
    def __init__(self):
        self.view_bool = False
        self.get_data(False)
        self.main_init()

    def main_init(self):
        self.gui_main()

    def main_refresh(self, all=False):
        self.get_data(all)
        if self.order_details == {}:
            self.listbox.delete(*self.listbox.get_children())
            self.listbox.insert("",
                                "end",
                                text="--",
                                values=("All orders cleared!", ))
        else:
            simple_details = []
            for id in self.order_ids:
                string = ""
                for item in self.order_details.get(id):
                    string += f"{item[1]} {item[0]}, "
                simple_details.append([
                    id, string[:40] +
                    "..." if len(string) > 40 else string[:len(string) - 2]
                ])

            self.listbox.delete(*self.listbox.get_children())
            for simple_detail in simple_details:
                self.listbox.insert("",
                                    "end",
                                    text=simple_detail[0],
                                    values=(simple_detail[1], ))

    def gui_main(self):
        # Root Window Init
        self.window = ThemedTk(theme="radiance")
        self.window.geometry("435x340")
        self.window.title("Restaurant Management System")
        self.window.configure(background="#F6F4F2")
        self.window.resizable(0, 0)

        self.view_var = BooleanVar()

        # Heading
        ttk.Label(self.window,
                  font=("default", 19, "bold"),
                  text="Kitchen Manager").grid(row=0,
                                               column=0,
                                               sticky="w",
                                               padx=15)
        ttk.Separator(self.window, orient="horizontal").grid(row=1,
                                                             columnspan=2,
                                                             sticky="ew")

        # Tree View
        self.listbox = ttk.Treeview(self.window)
        self.listbox["columns"] = ("Details")
        self.listbox.heading("#0", text="Order No")
        self.listbox.heading("#1", text="Details")
        self.listbox.column("#0", minwidth=0, width=100)
        self.listbox.column("#1", minwidth=0, width=300)
        self.listbox.bind('<Double-1>', self.selectItem)
        ttk.Style().configure("Treeview",
                              fieldbackground="#FEFEFE",
                              background="#FEFEFE")

        self.main_refresh(self.view_bool)
        self.listbox.grid(row=2, column=0, sticky="nse", padx=15, pady=10)

        self.view_all = ttk.Checkbutton(self.window,
                                        text="View all orders",
                                        variable=self.view_var,
                                        command=self.cb).grid(row=3,
                                                              column=0,
                                                              sticky="w",
                                                              padx=15)
        ttk.Button(self.window, text="Quit",
                   command=self.window.destroy).grid(row=3,
                                                     column=0,
                                                     sticky="e",
                                                     padx=15)
        self.window.mainloop()

    def cb(self):
        if self.view_var.get() == True:
            self.view_bool = True
        else:
            self.view_bool = False
        self.main_refresh(self.view_bool)

    def gui_details(self, id):
        # Open Details Window
        self.detail = ThemedTk(theme="radiance")
        self.detail.geometry("335x410")
        self.detail.title("Details")
        self.detail.configure(background="#F6F4F2")
        self.detail.resizable(0, 0)
        self.id = id

        # Heading
        ttk.Label(self.detail, font=("default", 19, "bold"),
                  text="Orders").grid(row=0, column=0, sticky="w", padx=15)
        ttk.Separator(self.detail, orient="horizontal").grid(row=1,
                                                             columnspan=2,
                                                             sticky="ew",
                                                             pady=(0, 5))

        # Create Default Lables
        ttk.Label(self.detail,
                  font=("default", 10, "bold"),
                  anchor="e",
                  width=18,
                  text="Order ID             : ").grid(row=2, column=0)
        ttk.Label(self.detail,
                  font=("default", 10, "bold"),
                  anchor="e",
                  width=18,
                  text="Customer Name : ").grid(row=3, column=0)

        # Create Buttons
        ttk.Button(self.detail,
                   text="Mark Done",
                   command=lambda: self.mark_done(self.id),
                   width=33).grid(row=5, column=0, columnspan=2)
        ttk.Button(
            self.detail,
            text="Previous",
            command=lambda: self.refresh(self.detail, "prev", self.id)).grid(
                row=6, column=0, sticky="w", padx=15)
        ttk.Button(
            self.detail,
            text="Next",
            command=lambda: self.refresh(self.detail, "next", self.id)).grid(
                row=6, column=1, sticky="e", padx=15)

        self.tree = ttk.Treeview(self.detail)
        self.tree["columns"] = ("Quantity")
        self.tree.heading("#0", text="Name")
        self.tree.heading("#1", text="Quantity")
        self.tree.column("#0", minwidth=0, width=230)
        self.tree.column("#1", minwidth=0, width=70)

    def mark_done(self, id):
        conn = sqlite3.connect("login_db.db")
        query = f"UPDATE orders SET delivered=1 WHERE order_no={id};"
        conn.execute(query)
        conn.commit()
        self.detail.destroy()
        self.main_refresh(self.view_bool)

    def selectItem(self, a):
        curItem = self.listbox.focus()
        id = self.listbox.item(curItem).get("text")
        if id == "--":
            pass
        else:
            self.gui_details(id)
            self.refresh(self.detail, None, id)

    def refresh(self, detail, fun, id):
        # Determine Function of Refresh else do nothing
        orders = self.order_ids
        if fun == "next":
            # When at end, loop back to start
            if orders.index(id) + 1 == len(orders):
                id = orders[0]
            else:
                id = orders[orders.index(id) + 1]

        elif fun == "prev":
            id = orders[orders.index(id) - 1]
        self.id = id

        # Create Changing Value Lables
        conn = sqlite3.connect("login_db.db")
        query = f"SELECT * FROM orders WHERE order_no={id}"
        items = conn.execute(query)
        converted_item = tuple(items)[0]
        ttk.Label(self.detail,
                  anchor="w",
                  width=18,
                  text=f"{converted_item[0]}").grid(row=2, column=1, padx=3)
        ttk.Label(self.detail,
                  anchor="w",
                  width=18,
                  text=f"{converted_item[1]}").grid(row=3, column=1, padx=3)

        self.tree.delete(*self.tree.get_children())
        for item in self.order_details.get(id):
            self.tree.insert("", "end", text=item[0], values=(item[1], ))

        for i in range(10):
            self.tree.insert("", "end", text="", values=("", ))

        self.tree.grid(row=4, column=0, columnspan=2, padx=15, pady=10)
        self.detail.mainloop()

    def get_data(self, all):
        self.order_details = km.db_retrieve(all)
        self.order_ids = km.order_ids(all)
Beispiel #30
0
        result_frame.grid_propagate(0)  # 组件大小不变

        # 目标反馈与评价
        feedback_frame = LabelFrame(self.cv_frame, text="第七步:目标反馈评价", width=600, height=50, bg='#fff2cc')
        feedback_frame.grid(row=6, column=0, sticky=W)
        feedback_frame.grid_propagate(0)  # 组件大小不变

    def return_main(self):
        """
        回到主页
        :return:
        """
        print("Event:回到主页")
        self.__init__(self.root)


if __name__ == "__main__":
    # 创建一个Top Level的根窗口, 并把他们作为参数实例化为App对象
    # root = tk.Tk()
    root = ThemedTk(theme="arc")
    root.title("CAICT地图绘制工具箱(CAICT-AtlasToolkit)")
    center_window(root, 0, 0)  # 设置窗口位置
    # root.maxsize(750, 800)
    root.minsize(770, 690)  # 设置窗口最小尺寸
    root.resizable(0, 0)  # 锁定尺寸
    # root.attributes("-alpha", 0.80)
    app = App(root)
    # 开始主事件循环
    root.mainloop()