def __init__(self, master): master.title('Supplychainpy') master.resizable(False, False) self.spawn = ReportsLauncher() self.parent = master self.hyperlink = '' app_dir = os.path.dirname(__file__, ) rel_path = 'supplychainpy/reporting/static/images/logo.gif' abs_file_path = os.path.abspath(os.path.join(app_dir, '..', rel_path)) logo = tk.PhotoImage(file=abs_file_path) self.style = ttk.Style() self.style.configure('TCheckbutton', background='black') self.style.configure('TLabel', background='black') # set supplychainpy logo for report launcher gui self.image = tk.Label(master, image=logo) self.image.image = logo self.image.config(background='black') self.image.grid(row=0, column=1, columnspan=2) self.instruction_label = tk.Label(master, text='Launch supplychainpy reports') self.instruction_label.grid(row=1, column=1, columnspan=6) self.instruction_label.config(background='black', foreground='white') self.hyperlink_label = tk.Label(master) self.hyperlink_label.config(background='black', foreground='#8dc53e', text='click to open browser:', font=('system', 10, 'bold')) self.validation_label = tk.Label(master) self.validation_label.config( background='black', foreground='red', text='Incorrect port! Please enter correct port number', font=('system', 10, 'bold')) self.runtime_validation_label = tk.Label(master) reporting_txt = 'The reports are already running @ {}'.format( self.hyperlink) self.runtime_validation_label.config(background='black', foreground='red', text=reporting_txt, font=('system', 10, 'bold')) self.port_label = tk.Label(master, text='Change port (default :5000):') self.port_label.config(background='black', foreground='white', justify=tk.RIGHT) self.port_text = tk.Entry(master, width=10) self.change_port = tk.BooleanVar() self.change_port.set(False) if os.name in ['posix', 'mac']: # sort out the checkbutton in ttk not tk report_style = ttk.Style() report_style.configure('Mac.TCheckbutton', focus='#000000', background='#000000', foreground='#FFFFFF') self.change_port_checkbutton = ttk.Checkbutton( master, variable=self.change_port, style='Mac.TCheckbutton', text='Change default port (default :5000)', command=lambda: self.show_port_entry()) elif os.name == 'nt': print('nt') self.change_port_checkbutton = tk.Checkbutton( master, variable=self.change_port, activebackground='black', activeforeground='white', bg='black', fg='white', relief='solid', selectcolor='blue', text='Change default port (default :5000)', command=lambda: self.show_port_entry()) self.change_port_checkbutton.config(onvalue=True) self.change_port_checkbutton.grid(row=2, column=1, columnspan=2, pady=(0, 10)) self.hyperlink_text = tk.Label(master) self.hyperlink_text.config(background='black', foreground='lightblue', font=('courier', 11, 'underline')) self.hyperlink_text.bind( "<Button-1>", lambda e, url=str(self.hyperlink): launch_browser(e, url)) self.launcher_button = tk.Button( master, bg='black', fg='grey', text='Launch Reporting', command=lambda: self.spawn_reports()).grid(row=6, column=1, pady=(5, 10), padx=(15, 5)) tk.Button(master, bg='black', fg='grey', text='Exit Reporting', command=lambda: exit_report()).grid(row=6, column=2, pady=(5, 10), padx=(5, 15))
def admin_panel(): win = tk.Tk() win.iconbitmap('AMS.ico') win.title("LogIn") win.geometry('880x420') win.configure(background='snow') def log_in(): username = un_entr.get() password = pw_entr.get() if username == 'kishan' : if password == 'kishan': win.destroy() import csv import tkinter root = tkinter.Tk() root.title("Student Details") root.configure(background='snow') cs = 'C:\project\attsys\StudentDetails\StudentDetails.csv' with open(cs, newline="") as file: reader = csv.reader(file) r = 0 for col in reader: c = 0 for row in col: # i've added some styling label = tkinter.Label(root, width=8, height=1, fg="black", font=('times', 15, ' bold '), bg="lawn green", text=row, relief=tkinter.RIDGE) label.grid(row=r, column=c) c += 1 r += 1 root.mainloop() else: valid = 'Incorrect ID or Password' Nt.configure(text=valid, bg="red", fg="black", width=38, font=('times', 19, 'bold')) Nt.place(x=120, y=350) else: valid ='Incorrect ID or Password' Nt.configure(text=valid, bg="red", fg="black", width=38, font=('times', 19, 'bold')) Nt.place(x=120, y=350) Nt = tk.Label(win, text="Attendance filled Successfully", bg="Green", fg="white", width=40, height=2, font=('times', 19, 'bold')) # Nt.place(x=120, y=350) un = tk.Label(win, text="Enter username", width=15, height=2, fg="white", bg="blue2", font=('times', 15, ' bold ')) un.place(x=30, y=50) pw = tk.Label(win, text="Enter password", width=15, height=2, fg="white", bg="blue2", font=('times', 15, ' bold ')) pw.place(x=30, y=150) def c00(): un_entr.delete(first=0, last=22) un_entr = tk.Entry(win, width=20, bg="yellow", fg="red", font=('times', 23, ' bold ')) un_entr.place(x=290, y=55) def c11(): pw_entr.delete(first=0, last=22) pw_entr = tk.Entry(win, width=20,show="*", bg="yellow", fg="red", font=('times', 23, ' bold ')) pw_entr.place(x=290, y=155) c0 = tk.Button(win, text="Clear", command=c00, fg="black", bg="deep pink", width=10, height=1, activebackground="Red", font=('times', 15, ' bold ')) c0.place(x=690, y=55) c1 = tk.Button(win, text="Clear", command=c11, fg="black", bg="deep pink", width=10, height=1, activebackground="Red", font=('times', 15, ' bold ')) c1.place(x=690, y=155) Login = tk.Button(win, text="LogIn", fg="black", bg="lime green", width=20, height=2, activebackground="Red",command=log_in, font=('times', 15, ' bold ')) Login.place(x=290, y=250) win.mainloop()
def __init__(self, arg): self.Email = arg self.root = tk.Tk() self.root.title('Professores') self.root.resizable(False, False) self.root.iconbitmap("book.ico") self.root.geometry('+350+20') self.root['bg'] = '#9fff80' self.Name = tk.Label(self.root, text='Nome:', font='Ariel 13 bold', fg='white', bg='#9fff80') self.Name.grid(row=0, column=0, columnspan=3, sticky=tk.W, padx=10, pady=10) self.Name_value = tk.StringVar(self.root, value="") self.Name_entry = ttk.Entry(self.root, font='Ariel, 10', textvariable=self.Name_value) self.Name_entry.grid(row=0, column=1, sticky=tk.W + tk.E, columnspan=2, padx=10, pady=10) self.CPF = tk.Label(self.root, text='CPF:', font='Ariel 13 bold', fg='white', bg='#9fff80') self.CPF.grid(row=1, column=0, columnspan=3, sticky=tk.W, padx=10, pady=10) self.CPF_value = tk.StringVar(self.root, value="") self.CPF_entry = ttk.Entry(self.root, font='Ariel, 10', textvariable=self.CPF_value) self.CPF_entry.grid(row=1, column=1, sticky=tk.W + tk.E, columnspan=2, padx=10, pady=10) self.Especialidade = tk.Label(self.root, text='Ramo:', font='Ariel 13 bold', fg='white', bg='#9fff80') self.Especialidade.grid(row=2, column=0, columnspan=3, sticky=tk.W, padx=10, pady=10) self.Especialidade_value = tk.StringVar(self.root, value="") self.Especialidade_entry = ttk.Entry( self.root, font='Ariel, 10', textvariable=self.Especialidade_value) self.Especialidade_entry.grid(row=2, column=1, sticky=tk.W + tk.E, columnspan=2, padx=10, pady=10) self.submit_button = ttk.Button(self.root, text='Cadastrar', cursor="hand2", command=self.write_record) self.submit_button.grid(row=0, column=3, padx=9, sticky=tk.W + tk.E) self.update_button = ttk.Button(self.root, text='Atualizar', cursor="hand2", command=self.update_record) self.update_button.grid(row=1, column=3, padx=9, sticky=tk.W + tk.E) self.delete_button = ttk.Button(self.root, text='Deletar', cursor="hand2", command=self.delete_record) self.delete_button.grid(row=2, column=3, padx=9, sticky=tk.W + tk.E) self.tree = ttk.Treeview(self.root, selectmode="browse", column=("column1", "column2", "column3", "column4"), show='headings') self.tree.column("column1", width=180, minwidth=100, stretch=tk.NO) self.tree.heading("#1", text="Nome") self.tree.column("column2", width=120, minwidth=100, stretch=tk.NO) self.tree.heading("#2", text="CPF") self.tree.column("column3", width=180, minwidth=100, stretch=tk.NO) self.tree.heading("#3", text="Especialidade") self.tree.column("column4", width=200, minwidth=100, stretch=tk.NO) self.tree.heading("#4", text="Departamento") self.tree.bind("<ButtonRelease-1>", self.select_item) self.tree.bind("<space>", self.select_item) self.tree.tag_configure('1', background='ivory2') self.tree.tag_configure('2', background='ivory2') self.tree.grid(row=4, column=0, padx=9, pady=9, sticky=tk.W + tk.E, columnspan=4) tk.Label(self.root, text='Pesquisar:', font='Ariel 13 bold', fg='white', bg='#9fff80').grid(row=5, column=0, columnspan=2, sticky=tk.E, padx=9, pady=9) self.search_value = tk.StringVar(self.root, value="") tk.Entry(self.root, textvariable=self.search_value).grid(row=5, column=2, sticky=tk.W + tk.E, padx=9, pady=9) self.search_button = ttk.Button(self.root, text='Pesquisar', cursor="hand2", command=self.search_record) self.search_button.grid(row=5, column=3, padx=9, sticky=tk.W + tk.E) self.refresh_button = ttk.Button(self.root, text='Atualizar', cursor="hand2", command=self.refresh) self.refresh_button.grid(row=6, column=2, padx=9, pady=9, sticky=tk.W + tk.E) self.back_button = ttk.Button(self.root, text='Voltar', cursor="hand2", command=self.back) self.back_button.grid(row=6, column=3, padx=9, sticky=tk.W + tk.E) self.setup_db() self.root.mainloop()
weather_json = response.json() results['text'] = format_response(response.json()) C = tk.Canvas(app, height=HEIGHT, width=WIDTH) background_image = tk.PhotoImage(file='./landscape.png') background_label = tk.Label(app, image=background_image) background_label.place(x=0, y=0, relwidth=1, relheight=1) C.pack() frame = tk.Frame(app, bg='#42c2f4', bd=5) frame.place(relx=0.5, rely=0.1, relwidth=0.75, relheight=0.1, anchor='n') #frame_window = C.create_window(100, 40, window=frame) textbox = tk.Entry(frame, font=40) textbox.place(relwidth=0.65, relheight=1) submit = tk.Button(frame, text='Check', font=40, command=lambda: get_details(textbox.get())) #submit.config(font=) submit.place(relx=0.7, relheight=1, relwidth=0.3) lower_frame = tk.Frame(app, bg='#42c2f4', bd=10) lower_frame.place(relx=0.5, rely=0.25, relwidth=0.75, relheight=0.6, anchor='n')
def subjectchoose(): def Fillattendances(): sub=tx.get() now = time.time() ###For calculate seconds of video future = now + 20 if time.time() < future: if sub == '': err_screen1() else: recognizer = cv2.face.LBPHFaceRecognizer_create() # cv2.createLBPHFaceRecognizer() try: recognizer.read("TrainingImageLabel\Trainner.yml") except: e = 'Model not found,Please train model' Notifica.configure(text=e, bg="red", fg="black", width=33, font=('times', 15, 'bold')) Notifica.place(x=20, y=250) harcascadePath = "haarcascade_frontalface_default.xml" faceCascade = cv2.CascadeClassifier(harcascadePath); df = pd.read_csv("StudentDetails\StudentDetails.csv") cam = cv2.VideoCapture(0) font = cv2.FONT_HERSHEY_SIMPLEX col_names = ['Enrollment', 'Name', 'Date', 'Time'] attendance = pd.DataFrame(columns=col_names) while True: ret, im = cam.read() gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) faces = faceCascade.detectMultiScale(gray, 1.2, 5) for (x, y, w, h) in faces: global Id Id, conf = recognizer.predict(gray[y:y + h, x:x + w]) if (conf > 50): print(conf) global Subject global aa global date global timeStamp Subject = tx.get() ts = time.time() date = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d') timeStamp = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S') aa = df.loc[df['Enrollment'] == Id]['Name'].values global tt tt = str(Id) + "-" + aa En = '15624031' + str(Id) attendance.loc[len(attendance)] = [Id, aa, date, timeStamp] cv2.rectangle(im, (x, y), (x + w, y + h), (0, 260, 0), 7) cv2.putText(im, str(tt), (x + h, y), font, 1, (255, 255, 0,), 4) else: Id = 'Unknown' tt = str(Id) cv2.rectangle(im, (x, y), (x + w, y + h), (0, 25, 255), 7) cv2.putText(im, str(tt), (x + h, y), font, 1, (0, 25, 255), 4) if time.time() > future: break attendance = attendance.drop_duplicates(['Enrollment'], keep='first') cv2.imshow('Filling attedance..', im) key = cv2.waitKey(30) & 0xff if key == 27: break ts = time.time() date = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d') timeStamp = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S') Hour, Minute, Second = timeStamp.split(":") ####Creatting csv of attendance fileName = "Attendance/" + Subject + "_" + date + "_" + Hour + "-" + Minute + "-" + Second + ".csv" attendance.to_csv(fileName, index=False) ##Create table for Attendance date_for_DB = datetime.datetime.fromtimestamp(ts).strftime('%Y_%m_%d') DB_Table_name = str( Subject + "_" + date_for_DB + "_Time_" + Hour + "_" + Minute + "_" + Second) import pymysql.connections ###Connect to the database try: global cursor connection = pymysql.connect(host='localhost', user='******', password='', db='test') cursor = connection.cursor() except Exception as e: print(e) sql = "CREATE TABLE " + DB_Table_name + """ (ID INT NOT NULL AUTO_INCREMENT, ENROLLMENT varchar(100) NOT NULL, NAME VARCHAR(50) NOT NULL, DATE VARCHAR(20) NOT NULL, TIME VARCHAR(20) NOT NULL, PRIMARY KEY (ID) ); """ ####Now enter attendance in Database insert_data = "INSERT INTO " + DB_Table_name + " (ID,ENROLLMENT,NAME,DATE,TIME) VALUES (0, %s, %s, %s,%s)" VALUES = (str(Id), str(aa), str(date), str(timeStamp)) try: cursor.execute(sql) ##for create a table cursor.execute(insert_data, VALUES)##For insert data into table except Exception as ex: print(ex) # M = 'Attendance filled Successfully' Notifica.configure(text=M, bg="Green", fg="white", width=33, font=('times', 15, 'bold')) Notifica.place(x=20, y=250) cam.release() cv2.destroyAllWindows() import csv import tkinter root = tkinter.Tk() root.title("Attendance of " + Subject) root.configure(background='snow') cs = 'C:/project/attsys/' + fileName with open(cs, newline="") as file: reader = csv.reader(file) r = 0 for col in reader: c = 0 for row in col: # i've added some styling label = tkinter.Label(root, width=8, height=1, fg="black", font=('times', 15, ' bold '), bg="lawn green", text=row, relief=tkinter.RIDGE) label.grid(row=r, column=c) c += 1 r += 1 root.mainloop() print(attendance) ###windo is frame for subject chooser windo = tk.Tk() windo.iconbitmap('AMS.ico') windo.title("Enter subject name...") windo.geometry('580x320') windo.configure(background='snow') Notifica = tk.Label(windo, text="Attendance filled Successfully", bg="Green", fg="white", width=33, height=2, font=('times', 15, 'bold')) def Attf(): import subprocess subprocess.Popen(r'explorer /select,"C:\project\attsys\Attendance\Manually Attendance\-------Check atttendance-------"') attf = tk.Button(windo, text="Check Sheets",command=Attf,fg="black" ,bg="lawn green" ,width=12 ,height=1 ,activebackground = "Red" ,font=('times', 14, ' bold ')) attf.place(x=430, y=255) sub = tk.Label(windo, text="Enter Subject", width=15, height=2, fg="white", bg="blue2", font=('times', 15, ' bold ')) sub.place(x=30, y=100) tx = tk.Entry(windo, width=20, bg="yellow", fg="red", font=('times', 23, ' bold ')) tx.place(x=250, y=105) fill_a = tk.Button(windo, text="Fill Attendance", fg="white",command=Fillattendances, bg="deep pink", width=20, height=2, activebackground="Red", font=('times', 15, ' bold ')) fill_a.place(x=250, y=160) windo.mainloop()
def __init__(self, parent, controller): tk.Frame.__init__(self, parent, bg="#4B0082") self.controller = controller label = tk.Label(self, text="ATM KIOSK", width=20, height=1, fg="white", bg="black", font=('Acme', 60, 'bold'), highlightcolor="orange") label.pack(side="top", pady=(30, 10)) label1 = tk.Label(self, text="Enter amount for withdrawal", width=30, height=2, fg="black", bg="powder blue", font=('robotic', 20, 'bold')) label1.pack(side="top", pady=20) self.entry1 = tk.Entry(self, relief="sunken", bd=3, validate="key") def withdrawal(): global account global withd withdraw = int(self.entry1.get()) withd = withdraw self.conn = pymysql.connect(host='localhost', database='atm', user='******', password='******', autocommit=True) cursor = self.conn.cursor() cursor.execute( "Select account_type from account_details where acc_no='%d'" % (account)) self.conn.commit() out = cursor.fetchone() if str(out[0]) == 'C': cursor.execute( "select balance from account_details where acc_no='%d'" % (account)) out = cursor.fetchone() if out[0] >= withdraw: cursor.execute( "insert into transaction(amount,account_no,status) values(%d,%d,'D')" % (withdraw, account)) cursor.execute( "Update account_details set balance =balance-'%d' WHERE acc_no='%d'" % (withdraw, account)) self.conn.commit() out = cursor.fetchone() row = cursor.fetchall() if (row != True): cursor.execute( "Select balance from account_details where acc_no='%d'" % (account)) out = cursor.fetchone() tk.messagebox.showinfo( "Withdrawal", "Successfully Withdrew Rs" + str(withdraw)) controller.show_frame("PageWithdrawed") else: cursor.execute( "select balance from account_details where acc_no='%d'" % (account)) out = cursor.fetchone() if out[0] >= withdraw and withdraw <= 25000 - withd: cursor.execute( "insert into transaction(amount,account_no,status) values(%d,%d,'D')" % (withdraw, account)) cursor.execute( "Update account_details set balance =balance-'%d' WHERE acc_no='%d'" % (withdraw, account)) self.conn.commit() out = cursor.fetchone() row = cursor.fetchall() if (row != True): tk.messagebox.showinfo( "Withdrawal", "Successfully Withdrew Rs" + str(withdraw)) controller.show_frame("PageWithdrawed") else: tk.messagebox.showinfo( "Withdrawal", "Amount exceeded the withdrawal limit") controller.show_frame("PageThree") button2 = tk.Button(self, text="Submit", command=lambda: withdrawal()) self.entry1.pack(side="top", pady="10") button2.pack(side="top", pady="20")
import tkinter as tk root = tk.Tk() canvas1 = tk.Canvas(root, width=400, height=300, relief='raised') canvas1.pack() label1 = tk.Label(root, text='Password Generator') label1.config(font=('helvetica', 14)) canvas1.create_window(200, 25, window=label1) label2 = tk.Label(root, text='Enter Level of Password (1, 2, 3, Alpha)') label2.config(font=('helvetica', 10)) canvas1.create_window(200, 100, window=label2) entry1 = tk.Entry(root) canvas1.create_window(200, 140, window=entry1) def generatePass(): x1 = entry1.get() lower = "abcdefghijklmnopqrstuvwxyz" upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" numbers = "0123456789" symbols = "*~_@#$%^&!" try: if x1 == '1': all = lower length = 6
win = tkinter.Tk() win.title("Excel") win.geometry("400x400+200+50") lable1 = tkinter.Label(win, text="文件名:", fg="pink", bg="grey", width=9, height=1, font=("黑体", 9), justify="left", anchor="w") lable1.pack() entry1 = tkinter.Entry(win, width=50) entry1.pack() lable2 = tkinter.Label(win, text="表名:", fg="pink", bg="grey", width=9, height=1, font=("黑体", 9), justify="left", anchor="w") lable2.pack() entry2 = tkinter.Entry(win, width=50) entry2.pack()
global oprator temp = variable.get() temp = temp[0:-1] oprator = temp variable.set(temp) def sum(): global oprator oprator = str(eval(oprator)) variable.set(oprator) # Display oprator = "" variable = tk.StringVar() display = tk.Entry(cal, textvariable=variable, font=("Verdana", 15, ), bd=12, insertwidth=4, width=14, justify="right") display.grid(columnspan=4) # Numbers Button button1 = tk.Button(cal, text='1', command=lambda: click(1), bg="gainsboro", bd=4, padx=12, pady=5, font=("Helvetica", 14, "bold")) button1.grid(row=2, column=0, ) button2 = tk.Button(cal, text='2', command=lambda: click(2), bg="gainsboro", bd=4, padx=12, pady=5, font=("Helvetica", 14, "bold")) button2.grid(row=2, column=1, ) button3 = tk.Button(cal, text='3', command=lambda:click(3), bg="gainsboro", bd=4, padx=12, pady=5, font=("Helvetica", 14, "bold")) button3.grid(row=2, column=2, ) button4 = tk.Button(cal, text='4', command=lambda: click(4), bg="gainsboro", bd=4, padx=12, pady=5, font=("Helvetica", 14, "bold")) button4.grid(row=3, column=0, )
window = t.Tk() #Creates the window base window.title( "Track and Trace") #Sets the title of the window to "Track and Trace" window.geometry( "360x270") #Sets the size of the window to 360 pixels by 270 pixels entry_frame = t.Frame(window) #Creates a frame to hold the entry widgets entry_label = t.Label(entry_frame, text="Phone Number:").pack( fill=t.Y) #Creates a label that says "Phone Number: " entry_button = t.Button( entry_frame, text="Submit", command=submit_button ).pack( side=t.RIGHT, fill=t.Y, padx=5 ) #Creates a button that says "Submit", runs the submit_button() function and is positioned to the right with 5 pixels of padding entry_text_entry = t.Entry( entry_frame) #Creates an entry box for the user to enter the phone number entry_text_entry.pack( side=t.RIGHT, fill=t.Y) #Packs the entry box and positions it to the right output_frame = t.Frame(window) #Creates a frame to hold the output widgets output_textbox = t.Text(output_frame, height=7.5, width=32) #Creates the output text box output_textbox.pack( side=t.TOP, fill=t.X) #Packs the output text box and positions it to the top output_clearbutton = t.Button( output_frame, text="Clear", command=clear_button ).pack( fill=t.X, pady=5 ) #Creates a button that says "Clear", runs the clear_button() function and is set to fill the X axis with 5 pixels of padding on the X axis output_textbox.insert("1.0", "Output:") #Sets the text box to say "Output:" output_textbox.configure(state="disabled")
''' # MARCO VIDEO DE ENTRADA marco_v_ent = ttk.Frame(app) marco_v_ent.pack(padx=4, pady=4) # ELEMENTOS DE VIDEO DE ENTRADA eti_v_ent = ttk.Label(marco_v_ent, text="Fichero de video:") eti_v_ent.grid(row=0, column=0, pady=5) v_json_obj = '' initial_dir = str(Path.PurePath("d:\\Vídeos")) v_ent_var = StringVar() v_ent_var.set('') ent_v_ent = tk.Entry(marco_v_ent, width=150, textvariable=v_ent_var) ent_v_ent.grid(row=0, column=1, padx=4) ent_v_ent.bind('<FocusOut>', ent_v_ent_focus) btn_v_ent = ttk.Button(marco_v_ent, text="Elige un vídeo", command=elige_video) btn_v_ent.grid(row=0, column=3) # MARCO ESCALA - SECUENCIA marco_escala_secuencia = ttk.Frame(app) marco_escala_secuencia.pack(padx=4, pady=4) # MARCO ESCALA marco_escala = ttk.Labelframe(marco_escala_secuencia, text='TAMAÑO DE VIDEO', labelanchor='n') marco_escala.grid(row=0, column=0, sticky='w', padx=4, pady=4) # ESCALA eti_tamaño = ttk.Label(marco_escala, text="Ancho:")
def oblicz(): dystans = float(entry1.get()) spalanie = float(entry2.get()) cena = float(entry3.get()) wynik = dystans / 100 * spalanie * cena wynik_label4.configure(text=f"Koszt przejazdu = {wynik:.2f} PLN") return wynik root = tk.Tk() przycisk = tk.Button(master=root, text="Oblicz", command=oblicz) przycisk.grid(row=15, column=15) label1 = tk.Label(master=root, text="Podaj dystans w km: ") label1.grid(row=1, column=0, sticky=tk.W) label2 = tk.Label(master=root, text="Podaj średnie spalanie na 100 km: ") label2.grid(row=2, column=0, sticky=tk.W) label3 = tk.Label(master=root, text="Podaj cenę paliwa w zł: ") label3.grid(row=3, column=0, sticky=tk.W) entry1 = tk.Entry(master=root) entry1.grid(row=1, column=1) entry2 = tk.Entry(master=root) entry2.grid(row=2, column=1) entry3 = tk.Entry(master=root) entry3.grid(row=3, column=1) wynik_label4 = tk.Label(master=root, text='') wynik_label4.grid(row=16, column=15) root.title("Kalkulator, cena przejazdu") root.mainloop()
def __init__(self, parent:QueControl): tk.Frame.__init__(self, parent) self.parent = parent self.select = [] #For selection purposes #TODO? uniform variables self.select_author = [] self.select_material = [] self.select_location = [] self.wrapperConnect = tk.LabelFrame(self, text = "Connection", bd=3) self.wrapperConnect.pack(fill="both", expand="yes", padx=20) self.wrapperConnect.grid_columnconfigure(1, weight=1) #expand entry self.wrapperList = tk.LabelFrame(self, text = "Item List", bd=3) self.wrapperList.pack(fill="both", expand="yes", padx=20) self.wrapperQuery = tk.LabelFrame(self, text = "Query", bd=3) self.wrapperQuery.pack(fill="both", expand="yes", padx=20, pady=10) self.wrapperQuery.grid_columnconfigure(1, weight=1) #expand entry self.wrapperItem = tk.LabelFrame(self, text = "Item Data", bd=3) self.wrapperItem.pack(fill="both", expand="yes", padx=20, pady=10) self.wrapperItem.grid_columnconfigure(1, weight=1) #expand entry #### CONNECT self.connectLabel = tk.Label(self.wrapperConnect, text="Query Endpoint", anchor="w") self.connectLabel.grid(row=0, column=0, padx=10) self.connectEntry = tk.Entry(self.wrapperConnect, width= 50, bg='white') self.connectEntry.grid(sticky="we", row=0, column= 1, padx=5) self.testButton = tk.Button(self.wrapperConnect, text="Test...", command= self.testButtonClick, padx=30) self.testButton.grid(row=0, column=2, padx=10) self.connection_path = 'http://159.65.77.213:3030/dataset/query' self.connectEntry.insert(0, self.connection_path) self.updateEndpointLabel = tk.Label(self.wrapperConnect, text="Update Endpoint", anchor="w") self.updateEndpointLabel.grid(row=1, column=0, padx=10) self.updateEndpointEntry = tk.Entry(self.wrapperConnect, width= 50, bg='white') self.updateEndpointEntry.grid(sticky="we", row=1, column= 1, padx=5) self.updateEndpoint_path = 'http://159.65.77.213:3030/dataset/update' self.updateEndpointEntry.insert(0, self.updateEndpoint_path) self.userLabel = tk.Label(self.wrapperConnect, text="User", anchor="w") self.userLabel.grid(row=2, column=0, padx=10) self.userEntry = tk.Entry(self.wrapperConnect, width= 50, bg='white') self.userEntry.grid(sticky="we", row=2, column= 1, padx=5) self.passwordLabel = tk.Label(self.wrapperConnect, text="Password", anchor="w") self.passwordLabel.grid(row=3, column=0, padx=10) self.passwordEntry = tk.Entry(self.wrapperConnect, width= 50, bg='white', show='*') self.passwordEntry.grid(sticky="we", row=3, column= 1, padx=5) self.user = '******' self.userEntry.insert(0, self.user) self.password = '******' self.passwordEntry.insert(0, self.password) #### LIST self.trv_frame = tk.Frame(self.wrapperList) self.trv_scroll_v = tk.Scrollbar(self.trv_frame) self.trv_scroll_h = tk.Scrollbar(self.trv_frame, orient=tk.HORIZONTAL) #Headings for treeview headings = {0 : "ID", 1 : "Title", 2 : "Author", 3 : "Material", 4 : "Location", 5 : "Period" , 6 : "Period Begin", 7 : "Period End", 8 : "Description", 9 : "Donor", 10 : "About Donor", 11 : "Verified"} self.trv = ttk.Treeview(self.trv_frame, columns=list(range(0,len(headings))), show="headings", yscrollcommand=self.trv_scroll_v.set, xscrollcommand=self.trv_scroll_h.set, height="4", selectmode="browse") for i in headings: self.trv.heading(i, text=headings[i]) self.trv.column(i, width=65, stretch=False) self.trv.tag_configure('oddrow', background='#E8E8E8') self.trv.tag_configure('evenrow', background='#A7D1E7') self.trv_scroll_v.config(command=self.trv.yview) self.trv_scroll_h.config(command=self.trv.xview) self.trv_frame.pack(fill="both", expand="yes") self.trv_scroll_v.pack(side=tk.RIGHT, fill=tk.Y) self.trv_scroll_h.pack(side=tk.BOTTOM, fill=tk.X) self.trv.pack(fill="both", expand="yes") self.trv.bind('<Double 1>', self.getrow) #Double click #### END LIST #### QUERY self.query1Label = tk.Label(self.wrapperQuery, text="Query 1", anchor="w") self.query2Label = tk.Label(self.wrapperQuery, text="Query 2", anchor="w") self.query3Label = tk.Label(self.wrapperQuery, text="Query 3", anchor="w") self.query4Label = tk.Label(self.wrapperQuery, text="Query 4", anchor="w") self.query5Label = tk.Label(self.wrapperQuery, text="Query 5", anchor="w") self.query1Entry = tk.Entry(self.wrapperQuery, width= 50, bg='white') self.query2Entry = tk.Entry(self.wrapperQuery, width= 50, bg='white') self.query3Entry = tk.Entry(self.wrapperQuery, width= 50, bg='white') self.query4Entry = tk.Entry(self.wrapperQuery, width= 50, bg='white') self.query5Entry = tk.Entry(self.wrapperQuery, width= 50, bg='white') valuesCombo = ['Title', 'Author', 'Material', 'Location', 'Period'] self.query1Combo = ttk.Combobox(self.wrapperQuery, width= 10, values=valuesCombo, state="readonly") self.query2Combo = ttk.Combobox(self.wrapperQuery, width= 10, values=valuesCombo, state="readonly") self.query3Combo = ttk.Combobox(self.wrapperQuery, width= 10, values=valuesCombo, state="readonly") self.query4Combo = ttk.Combobox(self.wrapperQuery, width= 10, values=valuesCombo, state="readonly") self.query5Combo = ttk.Combobox(self.wrapperQuery, width= 10, values=valuesCombo, state="readonly") self.query1Label.grid(sticky="w", row= 0, column=0, pady=5) self.query1Entry.grid(sticky="we",row=0, column= 1) self.query1Combo.grid(row=0, column= 2, padx=5) self.query2Label.grid(sticky="w", row= 1, column=0, pady=5) self.query2Entry.grid(sticky="we",row=1, column= 1) self.query2Combo.grid(row=1, column= 2, padx=5) self.query3Label.grid(sticky="w", row= 2, column=0, pady=5) self.query3Entry.grid(sticky="we", row=2, column= 1) self.query3Combo.grid(row=2, column= 2, padx=5) self.query4Label.grid(sticky="w", row= 3, column=0, pady=5) self.query4Entry.grid(sticky="we", row=3, column= 1) self.query4Combo.grid(row=3, column= 2, padx=5) self.query5Label.grid(sticky="w", row= 4, column=0, pady=5) self.query5Entry.grid(sticky="we", row=4, column= 1) self.query5Combo.grid(row=4, column= 2, padx=5) self.queryButton = tk.Button(self.wrapperQuery, text="Search...", command= self.queryButtonClick, padx=30) self.queryButton.grid(row=5, column=0, padx=5, columnspan=2) #### END QUERY #### ITEM DATA self.wrapperInsertButtons = tk.LabelFrame(self.wrapperItem, text = "", bd=0) self.idLabel = tk.Label(self.wrapperItem, text="ID", anchor="w") self.titleLabel = tk.Label(self.wrapperItem, text="Title", anchor="w") self.authorLabel = tk.Label(self.wrapperItem, text="Author", anchor="w") self.materialLabel = tk.Label(self.wrapperItem, text="Material", anchor="w") self.locationLabel = tk.Label(self.wrapperItem, text="Location", anchor="w") self.descriptionLabel = tk.Label(self.wrapperItem, text="Description", anchor="w") self.validatedValue = BooleanVar() self.validatedCheck = ttk.Checkbutton(self.wrapperItem, text="Validated", variable=self.validatedValue) self.validatedValue.set(False) update_photo = PhotoImage(master=self.parent.parent.parent.canvas, file='img/update1.png') search_photo = PhotoImage(master=self.parent.parent.parent.canvas, file='img/search-icon1.png') add_photo = PhotoImage(master=self.parent.parent.parent.canvas, file='img/add1.png') delete_photo = PhotoImage(master=self.parent.parent.parent.canvas, file='img/delete1.png') # self.idUpdButton = tk.Button(self.wrapperItem, text="Update", # command= lambda: self.updateButtonClick('id'), state=tk.DISABLED, padx=30) self.titleUpdButton = tk.Button(self.wrapperItem, text="Update", image=update_photo, command= lambda:self.updateButtonClick('title'), state=tk.DISABLED, padx=30) self.titleUpdButton.image = update_photo self.validatedUpdButton = tk.Button(self.wrapperItem, text="Update", image=update_photo, command= lambda:self.updateButtonClick('validated'), state=tk.DISABLED, padx=30) self.validatedUpdButton.image = update_photo self.authorUpdButton = tk.Button(self.wrapperItem, text="Update", image=update_photo, command= lambda:self.updateButtonClick('author'), state=tk.DISABLED, padx=0) self.authorUpdButton.image = update_photo self.materialUpdButton = tk.Button(self.wrapperItem, text="Update", image=update_photo, command= lambda:self.updateButtonClick('material'), state=tk.DISABLED, padx=30) self.materialUpdButton.image = update_photo self.locationUpdButton = tk.Button(self.wrapperItem, text="Update", image=update_photo, command= lambda:self.updateButtonClick('location'), state=tk.DISABLED, padx=30) self.locationUpdButton.image = update_photo self.descriptionUpdButton = tk.Button(self.wrapperItem, text="Update", image=update_photo, command= lambda:self.updateButtonClick('description'), state=tk.DISABLED, padx=30) self.descriptionUpdButton.image = update_photo self.authorSearchButton = tk.Button(self.wrapperItem, text="Search", image=search_photo, command= lambda:self.searchWindowButtonClick('author'), state=tk.DISABLED, padx=0) self.authorSearchButton.image = search_photo self.materialSearchButton = tk.Button(self.wrapperItem, text="Search", image=search_photo, command= lambda:self.searchWindowButtonClick('material'), state=tk.DISABLED, padx=0) self.materialSearchButton.image = search_photo self.locationSearchButton = tk.Button(self.wrapperItem, text="Search", image=search_photo, command= lambda:self.searchWindowButtonClick('location'), state=tk.DISABLED, padx=0) self.locationSearchButton.image = search_photo self.artifactAddButton= tk.Button(self.wrapperItem, text="Add", image=add_photo, command= lambda:self.addButtonClick('artifact'), state=tk.NORMAL, padx=0) self.artifactAddButton.image = add_photo self.artifactDelButton= tk.Button(self.wrapperItem, text="Delete", image=delete_photo, command= lambda:self.deleteButtonClick('artifact'), state=tk.NORMAL, padx=0) self.artifactDelButton.image = delete_photo self.buttons = [self.validatedUpdButton, self.titleUpdButton, self.authorUpdButton, self.materialUpdButton, self.locationUpdButton, self.descriptionUpdButton] self.searchButtons = [self.materialSearchButton, self.authorSearchButton, self.locationSearchButton] self.idEntry = tk.Entry(self.wrapperItem, width= 30, bg='white', disabledbackground='white', disabledforeground='gray', state=tk.DISABLED) self.titleEntry = tk.Entry(self.wrapperItem, width= 30, bg='white', disabledbackground='white', disabledforeground='gray') self.authorEntry = tk.Entry(self.wrapperItem, width= 30, bg='white', disabledbackground='white', disabledforeground='gray', state=tk.DISABLED) self.materialEntry = tk.Entry(self.wrapperItem, width= 30, bg='white', disabledbackground='white', disabledforeground='gray', state=tk.DISABLED) self.locationEntry = tk.Entry(self.wrapperItem, width= 30, bg='white', disabledbackground='white', disabledforeground='gray', state=tk.DISABLED) self.descriptionEntry = tk.Entry(self.wrapperItem, width= 30, bg='white', disabledbackground='white', disabledforeground='gray') # self.idEntry.bind('<Key>', lambda event: self.activateButton(event, self.idUpdButton) ) self.validatedCheck.bind('<Button>', lambda event: self.activateButton(event, self.validatedUpdButton) ) self.titleEntry.bind('<Key>', lambda event: self.activateButton(event, self.titleUpdButton) ) self.authorEntry.bind('<Key>', lambda event: self.activateButton(event, self.authorUpdButton) ) self.materialEntry.bind('<Key>', lambda event: self.activateButton(event, self.materialUpdButton) ) self.locationEntry.bind('<Key>', lambda event: self.activateButton(event, self.locationUpdButton) ) self.descriptionEntry.bind('<Key>', lambda event: self.activateButton(event, self.descriptionUpdButton) ) self.idLabel.grid(sticky="w", row= 0, column=0, pady=5) self.idEntry.grid(sticky="we", row=0, column= 1, padx=5) self.artifactAddButton.grid(row=0, column= 2, padx=5) self.artifactDelButton.grid(row=0, column= 3, padx=5) ttk.Separator(self.wrapperItem, orient=tk.VERTICAL).grid(sticky="ns", row=0, column=4) self.validatedCheck.grid(sticky="we", row=0, column= 5, padx=5) self.validatedUpdButton.grid(row=0, column= 6) self.titleLabel.grid(sticky="w", row= 1, column=0, pady=5) self.titleEntry.grid(sticky="we",row=1, column= 1, columnspan=5, padx=5) self.titleUpdButton.grid(row=1, column= 6, padx=5) self.authorLabel.grid(sticky="w", row= 2, column=0, pady=5) self.authorEntry.grid(sticky="we",row=2, column= 1, columnspan=5, padx=5) self.authorUpdButton.grid(row=2, column= 6, padx=5) self.authorSearchButton.grid(row=2, column=7) self.materialLabel.grid(sticky="w", row= 3, column=0, pady=5) self.materialEntry.grid(sticky="we",row=3, column= 1, columnspan=5, padx=5) self.materialUpdButton.grid(row=3, column= 6, padx=5) self.materialSearchButton.grid(row=3, column=7) self.locationLabel.grid(sticky="w", row= 4, column=0, pady=5) self.locationEntry.grid(sticky="we",row=4, column= 1, columnspan=5, padx=5) self.locationUpdButton.grid(row=4, column= 6, padx=5) self.locationSearchButton.grid(row=4, column=7) self.descriptionLabel.grid(sticky="w", row= 5, column=0, pady=5) self.descriptionEntry.grid(sticky="we",row=5, column= 1, columnspan=5, padx=5) self.descriptionUpdButton.grid(row=5, column= 6, padx=5) self.wrapperInsertButtons.grid(row=6, columnspan=6, padx=20) self.okInsertButton = tk.Button(self.wrapperInsertButtons, text="Ok", command= self.insertOkButtonClick, padx=30) # self.okInsertButton.grid(row=0, column=0, padx=5, pady=10) # self.okInsertButton.grid_forget() self.cancelInsertButton = tk.Button(self.wrapperInsertButtons, text="Cancel", command= self.insertCancelButtonClick, padx=30)
# -*- coding: utf-8 -*- """ Created on Thu May 16 14:16:38 2019 @author: User """ #Text輸入框 import tkinter as tk #匯入tkinter模組別名tk base = tk.Tk() #透過tkinter將TK類別實體化 string = tk.StringVar() entry = tk.Entry(base,textvariable=string).pack() label = tk.Label(base,textvariable=string).pack() base.mainloop() #讓GUI介面可以顯示出來
footer_frame=tk.Frame(window,bg='white',borderwidth = 1,highlightcolor="green",highlightbackground="green",highlightthickness=2,height=20,width=890) login_frame=tk.Frame(window,bg='white',borderwidth = 1,highlightcolor="green",highlightbackground="green",highlightthickness=2,height=223,width=218) message_frame=tk.Frame(window,bg='white',borderwidth = 1,highlightcolor="green",highlightbackground="green",highlightthickness=2,height=223,width=218) filter_frame=tk.Frame(window,bg='white',borderwidth = 1,highlightcolor="green",highlightbackground="green",highlightthickness=2,height=223,width=440) final_submit_frame=tk.Frame(window,bg="white",borderwidth = 1,highlightcolor="green",highlightbackground="green",highlightthickness=2,height=60,width=445) log_frame=tk.Frame(window,bg="white",borderwidth = 1,highlightcolor="green",highlightbackground="green",highlightthickness=2,height=385,width=445) log_title_frame=tk.Frame(log_frame,bg="white",borderwidth = 1,highlightcolor="green",highlightbackground="green",highlightthickness=2,height=60,width=433) sctext=scrolledtext.ScrolledText(log_frame,bg='black',width=51,height=19,fg='white',state='disabled') log_title_label=tk.Label(log_title_frame,text="Execution Log", font=("Arial Bold",20),bg='white',fg='green') message_title_frame=tk.Frame(message_frame,bg='white',borderwidth = 1,highlightcolor="green",highlightbackground="green",highlightthickness=2,height=40,width=206) login_title_frame=tk.Frame(login_frame,bg='white',borderwidth = 1,highlightcolor="green",highlightbackground="green",highlightthickness=2,height=40,width=206) message_title_label=tk.Label(message_title_frame,text="Enter Message", font=("Arial Bold",13),bg='white',fg='green') login_title_label=tk.Label(login_title_frame,text="Login Credentials", font=("Arial Bold",13),bg='white',fg='green') username_label=tk.Label(login_frame,text="LinkedIn Username:"******"Arial ",10),bg='white',fg='green') password_label=tk.Label(login_frame,text="LinkedIn Password:"******"Arial ",10),bg='white',fg='green') username_entry=tk.Entry(login_frame,width=30,bg='black',fg='white',insertbackground='white') password_entry=tk.Entry(login_frame,show="*",width=30,bg='black',fg='white',insertbackground='white') message_entry=scrolledtext.ScrolledText(message_frame,bg='black',width=23,height=7,fg='white',insertbackground='white') button_login = tk.Button(login_frame, text=" Save ", fg="black", activebackground = "green",command=save_credentials) button_message = tk.Button(message_frame, text=" Save ", fg="black", activebackground = "green",command=save_message) message_popup=tk.Label(message_frame,text="", font=("Arial",8),bg='white') login_popup=tk.Label(login_frame,text="", font=("Arial",8),bg='white') filter_title_frame=tk.Frame(filter_frame,bg='white',borderwidth = 1,highlightcolor="green",highlightbackground="green",highlightthickness=2,height=40,width=425) filter_title_label=tk.Label(filter_title_frame,text="Enter Search Filters", font=("Arial Bold",15),bg='white',fg='green') region_label=tk.Label(filter_frame,text="Region:", font=("Arial ",10),bg='white',fg='green') region_entry=tk.Entry(filter_frame,width=30,bg='black',fg='white',insertbackground='white') button_filter = tk.Button(filter_frame, text=" Save ", fg="black", activebackground = "green",command=save_filters) filter_popup=tk.Label(filter_frame,text="", font=("Arial",8),bg='white') button_start_process = tk.Button(final_submit_frame, text=" Start Process ", fg="black", activebackground = "green",command=lambda:start_submit_thread(None)) start_popup=tk.Label(final_submit_frame,text="", font=("Arial",8),bg='white') current_companies_label=tk.Label(filter_frame,text="Company:", font=("Arial ",10),bg='white',fg='green')
import tkinter as tk def downloadVid(): global E1 string = E1.get() yt = youtube(str(string)) videos = yt.get_videos() s = 1 for v in videos: print(str(s) + '.' + str(v)) s += 1 n = int(input("Enter your choice")) vid = videos[n - 1] destination = str(input("Enter your destination")) vid.download(destination) print(yt.filename + "\n Ha been downloaded") root = tk.Tk() w = tk.Label(root, text="Youtube Downloader") w.pack() E1 = tk.Entry(root, bd=5) E1.pack(side=tk.TOP) button = tk.Button(root, text="Download", fg="red", command=downloadVid) button.pack(side=tk.BOTTOM) root.mainloop()
def __init__(self, parent, controller): global account tk.Frame.__init__(self, parent, bg="#4B0082") self.controller = controller label = tk.Label(self, text="ATM KIOSK", width=20, height=1, fg="white", bg="black", font=('Acme', 60, 'bold'), highlightcolor="orange") label.pack(side="top", pady=(30, 10)) localtime = time.asctime(time.localtime(time.time())) label2 = tk.Label(self, text=localtime, width=20, height=1, fg="blue", font=('robotic', 20, 'bold')) label2.pack(side="top", pady=20) self.label1 = tk.Label(self, text="Enter Account Number", width=20, height=2, fg="black", bg="powder blue", font=('robotic', 30, 'bold')) self.label1.pack(side="top", pady=20) self.entry1 = tk.Entry(self, relief="sunken", bd=3, validate="key", insertwidth=4) def acc_validation(): global account acc = int(self.entry1.get()) self.conn = pymysql.connect(host='localhost', database='atm', user='******', password='******') cursor = self.conn.cursor() cursor.execute( "SELECT name FROM user_details WHERE account_no='%d'" % (acc)) row = cursor.fetchall() if (row != ()): cursor.execute( "SELECT name FROM user_details WHERE account_no='%d'" % (acc)) out = cursor.fetchone() account = acc self.entry1.delete(0, 'end') controller.show_frame("PageOne") else: tk.messagebox.showinfo("Validation", "Account Not Found") self.entry1.delete(0, "end") button1 = tk.Button(self, text="Submit", command=lambda: acc_validation()) self.entry1.pack(side="top", pady="10") button1.pack(side="top", pady="20")
# Begin loop. while True: # Let the user adjust parameters via a GUI. panel = tkinter.Tk() panel.title("Select parameters") panel.geometry("750x450") instructions = tkinter.Label(panel, text="Please select parameters.\n", font=("Arial", 14)) if did_zorks_die_out_last_run: # If the last run failed due to extinction, edit this message to inform the user: instructions.config(text="There was a generation of 0 or 1 zorks! No graph generated.") instructions.grid(row=0, column=0) label_max_number_generations = tkinter.Label(panel, text="Number of generations", font=("Arial", 14)) label_max_number_generations.grid(row=1, column=0) entry_max_number_generations = tkinter.Entry(panel, width=30) entry_max_number_generations.insert(0, str(max_number_generations)) entry_max_number_generations.grid(row=1, column=1) label_base_threshold_to_survive = tkinter.Label(panel, text="Base survival threshold (higher is harsher)", font=("Arial", 14)) label_base_threshold_to_survive.grid(row=2, column=0) entry_base_threshold_to_survive = tkinter.Entry(panel, width=30) entry_base_threshold_to_survive.insert(0, str(base_threshold_to_survive)) entry_base_threshold_to_survive.grid(row=2, column=1) label_environment_caprice = tkinter.Label(panel, text="Environment caprice (higher is more unfair)", font=("Arial", 14)) label_environment_caprice.grid(row=3, column=0) entry_environment_caprice = tkinter.Entry(panel, width=30) entry_environment_caprice.insert(0, str(environment_caprice))
def __init__(self, parent, controller): global account tk.Frame.__init__(self, parent, bg="#4B0082") self.controller = controller label = tk.Label(self, text="ATM KIOSK", width=20, height=1, fg="white", bg="black", font=('Acme', 60, 'bold'), highlightcolor="orange") label.pack(side="top", pady=(30, 10)) self.label1 = tk.Label(self, text="Enter new pin", width=20, height=2, fg="black", bg="powder blue", font=('robotic', 30, 'bold')) self.label1.pack(side="top", pady=20) self.entry1 = tk.Entry(self, relief="sunken", bd=3, validate="key", insertwidth=4, show="*") def pin_setting(): global account pin = int(self.entry1.get()) self.conn = pymysql.connect(host='localhost', database='atm', user='******', password='******', autocommit=True) cursor = self.conn.cursor() cursor.execute( "SELECT name FROM user_details WHERE account_no='%d'" % (account)) row = cursor.fetchall() if (row != ()): cursor.execute( "UPDATE user_details set pin='%d' WHERE account_no='%d'" % (pin, account)) out = cursor.fetchone() self.conn.commit() cursor.execute( "SELECT pin FROM user_details WHERE account_no='%d'" % (account)) out = cursor.fetchone() tk.messagebox.showinfo("Validation", "Pin changed Successfully") controller.show_frame("PageTwo") else: tk.messagebox.showinfo( "Validation", "Some problem occured Please try again after some time") self.entry1.delete(0, "end") button1 = tk.Button(self, text="Submit", command=lambda: pin_setting()) self.entry1.pack(side="top", pady="10") button1.pack(side="top", pady="20")
def __init__(self, window): self.handData = [] self.x_points = [] self.y_points = [] self.forget_param_x = 0.95 self.forget_param_y = 0.90 self.pre_up = 0.0 self.pre_down = 0.0 self.pre_right = 0.0 self.pre_left = 0.0 self.gesture_list = [] self.MODE_FLAG = 3 self.window = window # 창 상단 프르그램 명 설정 self.window.title("CSEE 316 project") # 창 크기 설정 self.window.geometry("800x500") #크기 일단은 불변 self.window.resizable(False, False) # 현재 상태 글귀 result_txt self.State_txt = tkinter.Label(self.window, text="현재 모드") self.State_txt.place(x=0, y=0) #현재 상태 출력 창 State self.State = tkinter.Entry(self.window, justify='center') self.State.place(x=0, y=20) # 인식 결과 글귀 result_txt self.result_txt = tkinter.Label(self.window, text="인식 결과") self.result_txt.place(x=0, y=40) #인식결과 출력 창 result_output self.result_output = tkinter.Entry(self.window, justify='center') self.result_output.place(x=0, y=60) self.Test = tkinter.Button(self.window, text=" Test ", command=lambda: self.button_pressed_Test()) self.Test.place(x=0, y=80) #Stop 버튼 생성 클릭 시 listbox에 등록 self.Stop2 = tkinter.Button(self.window, text=" Stop ", command=lambda: self.button_pressed_stop()) self.Stop2.place(x=70, y=80) #제스쳐명 글귀 self.lbl = tkinter.Label(self.window, text="제스쳐 등록") self.lbl.place(x=0, y=110) #제스처 입력창 input_gesture self.input_gesture = tkinter.Entry(self.window, justify='center') self.input_gesture.place(x=0, y=130) #Train 버튼 생성 클릭 시 listbox에 등록 self.Train = tkinter.Button( self.window, text=" Train ", command=lambda: self.button_pressed_Train()) self.Train.place(x=0, y=150) #Stop 버튼 생성 클릭 시 listbox에 등록 self.Stop = tkinter.Button(self.window, text=" Stop ", command=lambda: self.button_pressed_stop()) self.Stop.place(x=70, y=150) # 등록된 제스쳐 글귀 self.lbl2 = tkinter.Label(self.window, text="등록된 제스쳐") self.lbl2.place(x=0, y=180) #등록된 제스쳐 목록 및 스크롤 바 설정 self.frame = tkinter.Frame(self.window) self.scrollbar = tkinter.Scrollbar(self.frame) self.scrollbar.pack(side="right", fill="y") self.listbox = tkinter.Listbox(self.frame, yscrollcommand=self.scrollbar.set) self.listbox.pack(side="left") self.scrollbar["command"] = self.listbox.yview self.frame.place(x=0, y=200) # Reset ,및 delete 버튼 클릭시, listbox 초기화 # reset button clear the listbox self.Reset = tkinter.Button(self.window, text=" Reset ", command=self.button_pressed_Reset) self.Reset.place(x=70, y=380) # delete button self.btn2 = tkinter.Button(self.window, text=" Delete ", command=self.delete_element) self.btn2.place(x=0, y=380) # screen 창 self.src = cv2.imread(r"hand_image.jpg") self.img = cv2.resize(self.src, (640, 480)) self.canvas = tkinter.Canvas(window, width=640, height=480) self.photo = PIL.ImageTk.PhotoImage( image=PIL.Image.fromarray(self.img)) self.canvas.create_image(0, 0, image=self.photo, anchor=tkinter.NW) self.canvas.place(x=150, y=0) ##create ARTMAP class self.Artmap = ARTMAP.Fuzzy_ARTMAP() ## ##network connection self.server = Server.TCP_server() ## self.streaming_screen() self.window.mainloop()
def __init__(self, parent, controller): tk.Frame.__init__(self, parent) e = tk.Entry(self, bg="white", font=LARGE_FONT) e.place(x=900, y=280, width=300, height=100) def button_click(number): digito_anterior = e.get() e.delete(0, tk.END) e.insert(0, str(digito_anterior) + str(number)) def button_clear(): e.delete(0, tk.END) label = tk.Label(self, text="Insertar Constante", font=LARGE_FONT) label.place(x=450, y=60, width=600, height=70) button1 = ttk.Button(self, text="Confirmar valor", command=lambda: controller.show_frame(Parametros), image="") button1.place(x=900, y=600, width=300, height=100) button2 = ttk.Button(self, text="Atrás", command=lambda: controller.show_frame(Principal)) button2.place(x=100, y=70, width=200, height=80) button3 = ttk.Button(self, text="7", command=lambda: button_click(7)) button3.place(x=250, y=280, width=100, height=100) button4 = ttk.Button(self, text="8", command=lambda: button_click(8)) button4.place(x=350, y=280, width=100, height=100) button4 = ttk.Button(self, text="9", command=lambda: button_click(9)) button4.place(x=450, y=280, width=100, height=100) button5 = ttk.Button(self, text="4", command=lambda: button_click(4)) button5.place(x=250, y=380, width=100, height=100) button6 = ttk.Button(self, text="5", command=lambda: button_click(5)) button6.place(x=350, y=380, width=100, height=100) button7 = ttk.Button(self, text="6", command=lambda: button_click(6)) button7.place(x=450, y=380, width=100, height=100) button8 = ttk.Button(self, text="1", command=lambda: button_click(1)) button8.place(x=250, y=480, width=100, height=100) button9 = ttk.Button(self, text="2", command=lambda: button_click(2)) button9.place(x=350, y=480, width=100, height=100) button10 = ttk.Button(self, text="3", command=lambda: button_click(3)) button10.place(x=450, y=480, width=100, height=100) button11 = ttk.Button(self, text=".", command=lambda: button_click('.')) button11.place(x=250, y=580, width=100, height=100) button11 = ttk.Button(self, text="0", command=lambda: button_click(0)) button11.place(x=350, y=580, width=100, height=100) button11 = ttk.Button(self, text="borrar", command=button_clear) button11.place(x=450, y=580, width=100, height=100)
btn_adv.pack(side='right') #frame VNFD frame_vnfd = tk.Frame(root, bg=clr_bg) frame_vnfd.pack(fill='x') #label tk.Label(frame_vnfd, text='', bg=clr_bg, fg=clr_fg, font=f1).pack(side='top', padx=2, pady=5) #entry frame_ve1 = tk.Frame(frame_vnfd) frame_ve1.pack(padx=30, pady=10) v_vnf_type = tk.StringVar() v_vnf_type.set('vnf type (e.g. AMF/SMF/PCF)') e_vnf_type = tk.Entry(frame_ve1, width=35, bd=0, textvariable=v_vnf_type) e_vnf_type.pack() #buttons frame_vb1 = tk.Frame(frame_vnfd) frame_vb1.pack(padx=30, pady=5) frame_vb2 = tk.Frame(frame_vnfd) frame_vb2.pack(padx=30, pady=5) frame_vb3 = tk.Frame(frame_vnfd) frame_vb3.pack(padx=30, pady=5) frame_vb4 = tk.Frame(frame_vnfd) frame_vb4.pack(padx=30, pady=5) frame_vb5 = tk.Frame(frame_vnfd) frame_vb5.pack(padx=30, pady=10) ck_value1 = IntVar() cbt1 = tk.Checkbutton(frame_vb4,
message.place(x=80, y=20) Notification = tk.Label(window, text="All things good", bg="Green", fg="white", width=15, height=3, font=('times', 17, 'bold')) lbl = tk.Label(window, text="Enter Enrollment", width=20, height=2, fg="black", bg="deep pink", font=('times', 15, ' bold ')) lbl.place(x=200, y=200) def testVal(inStr,acttyp): if acttyp == '1': #insert if not inStr.isdigit(): return False return True txt = tk.Entry(window, validate="key", width=20, bg="yellow", fg="red", font=('times', 25, ' bold ')) txt['validatecommand'] = (txt.register(testVal),'%P','%d') txt.place(x=550, y=210) lbl2 = tk.Label(window, text="Enter Name", width=20, fg="black", bg="deep pink", height=2, font=('times', 15, ' bold ')) lbl2.place(x=200, y=300) txt2 = tk.Entry(window, width=20, bg="yellow", fg="red", font=('times', 25, ' bold ')) txt2.place(x=550, y=310) clearButton = tk.Button(window, text="Clear",command=clear,fg="black" ,bg="deep pink" ,width=10 ,height=1 ,activebackground = "Red" ,font=('times', 15, ' bold ')) clearButton.place(x=950, y=210) clearButton1 = tk.Button(window, text="Clear",command=clear1,fg="black" ,bg="deep pink" ,width=10 ,height=1, activebackground = "Red" ,font=('times', 15, ' bold ')) clearButton1.place(x=950, y=310)
def loop(): #GUI global tcpClicSock, BtnIP, led_status, BtnVIN, l_VIN, TestMode #The value of tcpClicSock changes in the function loop(),would also changes in global so the other functions could use it. while True: root = tk.Tk() #Define a window named root root.title('Adeept') #Main window title root.geometry( '917x630') #Main window size, middle of the English letter x. root.config(bg=color_bg) #Set the background color of root window var_spd = tk.StringVar() #Speed value saved in a StringVar var_spd.set( 1 ) #Set a default speed,but change it would not change the default speed value in the car,you need to click button'Set' to send the value to the car var_x_scan = tk.IntVar() #Scan range value saved in a IntVar var_x_scan.set(2) #Set a default scan value # logo =tk.PhotoImage(file = 'logo.png') #Define the picture of logo,but only supports '.png' and '.gif' # l_logo=tk.Label(root,image = logo,bg=color_bg) #Set a label to show the logo picture # l_logo.place(x=30,y=13) #Place the Label in a right position BtnC1 = tk.Button(root, width=15, text='Camera Middle', fg=color_text, bg=color_btn, relief='ridge') BtnC1.place(x=785, y=10) E_C1 = tk.Entry(root, show=None, width=16, bg="#37474F", fg='#eceff1', exportselection=0, justify='center') E_C1.place(x=785, y=45) #Define a Entry and put it in position BtnC2 = tk.Button(root, width=15, text='Ultrasonic Middle', fg=color_text, bg=color_btn, relief='ridge') BtnC2.place(x=785, y=100) E_C2 = tk.Entry(root, show=None, width=16, bg="#37474F", fg='#eceff1', exportselection=0, justify='center') E_C2.place(x=785, y=135) #Define a Entry and put it in position BtnM1 = tk.Button(root, width=15, text='Motor A Speed', fg=color_text, bg=color_btn, relief='ridge') BtnM1.place(x=785, y=190) E_M1 = tk.Entry(root, show=None, width=16, bg="#37474F", fg='#eceff1', exportselection=0, justify='center') E_M1.place(x=785, y=225) #Define a Entry and put it in position BtnM2 = tk.Button(root, width=15, text='Motor B Speed', fg=color_text, bg=color_btn, relief='ridge') BtnM2.place(x=785, y=280) E_M2 = tk.Entry(root, show=None, width=16, bg="#37474F", fg='#eceff1', exportselection=0, justify='center') E_M2.place(x=785, y=315) #Define a Entry and put it in position BtnT1 = tk.Button(root, width=15, text='Look Up Max', fg=color_text, bg=color_btn, relief='ridge') BtnT1.place(x=785, y=370) E_T1 = tk.Entry(root, show=None, width=16, bg="#37474F", fg='#eceff1', exportselection=0, justify='center') E_T1.place(x=785, y=405) #Define a Entry and put it in position BtnT2 = tk.Button(root, width=15, text='Look Down Max', fg=color_text, bg=color_btn, relief='ridge') BtnT2.place(x=785, y=460) E_T2 = tk.Entry(root, show=None, width=16, bg="#37474F", fg='#eceff1', exportselection=0, justify='center') E_T2.place(x=785, y=495) #Define a Entry and put it in position BtnLED = tk.Button(root, width=15, text='Lights ON', fg=color_text, bg=color_btn, relief='ridge') BtnLED.place(x=300, y=420) BtnOCV = tk.Button(root, width=15, text='OpenCV', fg=color_text, bg=color_btn, relief='ridge', command=call_opencv) BtnOCV.place(x=30, y=420) BtnFL = tk.Button(root, width=15, text='Find Line', fg=color_text, bg=color_btn, relief='ridge') BtnFL.place(x=165, y=420) BtnSR3 = tk.Button(root, width=15, text='Sphinx SR', fg=color_text, bg=color_btn, relief='ridge', command=call_SR3) BtnSR3.place(x=300, y=495) E_C1.insert(0, 'Default:425') E_C2.insert(0, 'Default:425') E_M1.insert(0, 'Default:100') E_M2.insert(0, 'Default:100') E_T1.insert(0, 'Default:662') E_T2.insert(0, 'Default:295') can_scan = tk.Canvas(root, bg=color_can, height=250, width=320, highlightthickness=0) #define a canvas can_scan.place(x=440, y=330) #Place the canvas line = can_scan.create_line(0, 62, 320, 62, fill='darkgray') #Draw a line on canvas line = can_scan.create_line(0, 124, 320, 124, fill='darkgray') #Draw a line on canvas line = can_scan.create_line(0, 186, 320, 186, fill='darkgray') #Draw a line on canvas line = can_scan.create_line(160, 0, 160, 250, fill='darkgray') #Draw a line on canvas line = can_scan.create_line(80, 0, 80, 250, fill='darkgray') #Draw a line on canvas line = can_scan.create_line(240, 0, 240, 250, fill='darkgray') #Draw a line on canvas x_range = var_x_scan.get() can_tex_11 = can_scan.create_text( (27, 178), text='%sm' % round( (x_range / 4), 2), fill='#aeea00') #Create a text on canvas can_tex_12 = can_scan.create_text( (27, 116), text='%sm' % round( (x_range / 2), 2), fill='#aeea00') #Create a text on canvas can_tex_13 = can_scan.create_text( (27, 54), text='%sm' % round( (x_range * 0.75), 2), fill='#aeea00') #Create a text on canvas def spd_set(): #Call this function for speed adjustment tcpClicSock.send(('spdset:%s' % var_spd.get()).encode( )) #Get a speed value from IntVar and send it to the car l_ip_2.config( text='Speed:%s' % var_spd.get()) #Put the speed value on the speed status label def EC1_set(event): #Call this function for speed adjustment tcpClicSock.send(('EC1set:%s' % E_C1.get()).encode( )) #Get a speed value from IntVar and send it to the car def EC2_set(event): #Call this function for speed adjustment tcpClicSock.send(('EC2set:%s' % E_C2.get()).encode( )) #Get a speed value from IntVar and send it to the car def EM1_set(event): #Call this function for speed adjustment tcpClicSock.send(('EM1set:%s' % E_M1.get()).encode( )) #Get a speed value from IntVar and send it to the car def EM2_set(event): #Call this function for speed adjustment tcpClicSock.send(('EM2set:%s' % E_M2.get()).encode( )) #Get a speed value from IntVar and send it to the car def ET1_set(event): #Call this function for speed adjustment tcpClicSock.send(('LUMset:%s' % E_T1.get()).encode( )) #Get a speed value from IntVar and send it to the car def ET2_set(event): #Call this function for speed adjustment tcpClicSock.send(('LDMset:%s' % E_T2.get()).encode( )) #Get a speed value from IntVar and send it to the car def connect(event): #Call this function to connect with the server if ip_stu == 1: sc = thread.Thread( target=socket_connect) #Define a thread for connection sc.setDaemon( True ) #'True' means it is a front thread,it would close when the mainloop() closes sc.start() #Thread starts def connect_2(): #Call this function to connect with the server if ip_stu == 1: sc = thread.Thread( target=socket_connect) #Define a thread for connection sc.setDaemon( True ) #'True' means it is a front thread,it would close when the mainloop() closes sc.start() #Thread starts def socket_connect(): #Call this function to connect with the server global ADDR, tcpClicSock, BUFSIZ, ip_stu, ipaddr ip_adr = E1.get() #Get the IP address from Entry if ip_adr == '': #If no input IP address in Entry,import a default IP ip_adr = num_import('IP:') l_ip_4.config(text='Connecting') l_ip_4.config(bg='#FF8F00') l_ip_5.config(text='Default:%s' % ip_adr) pass SERVER_IP = ip_adr SERVER_PORT = 10223 #Define port serial BUFSIZ = 1024 #Define buffer size ADDR = (SERVER_IP, SERVER_PORT) tcpClicSock = socket(AF_INET, SOCK_STREAM) #Set connection value for socket for i in range(1, 6): #Try 5 times if disconnected try: if ip_stu == 1: print("Connecting to server @ %s:%d..." % (SERVER_IP, SERVER_PORT)) print("Connecting") tcpClicSock.connect(ADDR) #Connection with the server print("Connected") l_ip_5.config(text='IP:%s' % ip_adr) l_ip_4.config(text='Connected') l_ip_4.config(bg='#558B2F') replace_num('IP:', ip_adr) E1.config(state='disabled') #Disable the Entry Btn14.config(state='disabled') #Disable the Entry ip_stu = 0 #'0' means connected at = thread.Thread( target=code_receive ) #Define a thread for data receiving at.setDaemon( True ) #'True' means it is a front thread,it would close when the mainloop() closes at.start() #Thread starts SR_threading = thread.Thread( target=voice_command_thread ) #Define a thread for ultrasonic tracking SR_threading.setDaemon( True ) #'True' means it is a front thread,it would close when the mainloop() closes SR_threading.start() #Thread starts video_thread = thread.Thread( target=video_show ) #Define a thread for data receiving video_thread.setDaemon( True ) #'True' means it is a front thread,it would close when the mainloop() closes print('Video Connected') video_thread.start() #Thread starts ipaddr = tcpClicSock.getsockname()[0] break else: break except Exception: print("Cannot connecting to server,try it latter!") l_ip_4.config(text='Try %d/5 time(s)' % i) l_ip_4.config(bg='#EF6C00') print('Try %d/5 time(s)' % i) ip_stu = 1 time.sleep(1) continue if ip_stu == 1: l_ip_4.config(text='Disconnected') l_ip_4.config(bg='#F44336') def code_receive(): #A function for data receiving global led_status, ipcon, findline_status, auto_status, opencv_status, speech_status, TestMode while True: code_car = tcpClicSock.recv( BUFSIZ) #Listening,and save the data in 'code_car' l_ip.config(text=code_car) #Put the data on the label #print(code_car) if not code_car: continue elif 'SET' in str(code_car): print('set get') set_list = code_car.decode() set_list = set_list.split() s1, s2, s3, s4, s5, s6 = set_list[1:] E_C1.delete(0, 50) E_C2.delete(0, 50) E_M1.delete(0, 50) E_M2.delete(0, 50) E_T1.delete(0, 50) E_T2.delete(0, 50) E_C1.insert(0, '%d' % int(s1)) E_C2.insert(0, '%d' % int(s2)) E_M1.insert(0, '%d' % int(s3)) E_M2.insert(0, '%d' % int(s4)) E_T1.insert(0, '%d' % int(s5)) E_T2.insert(0, '%d' % int(s6)) elif 'list' in str(code_car): #Scan result receiving start dis_list = [] f_list = [] list_str = code_car.decode() while True: #Save scan result in dis_list code_car = tcpClicSock.recv(BUFSIZ) if 'finished' in str(code_car): break list_str += code_car.decode() l_ip.config(text='Scanning') dis_list = list_str.split() #Save the data as a list l_ip.config(text='Finished') for i in range( 0, len(dis_list) ): #Translate the String-type value in the list to Float-type try: new_f = float(dis_list[i]) f_list.append(new_f) except: continue dis_list = f_list #can_scan.delete(line) #can_scan.delete(point_scan) can_scan_1 = tk.Canvas( root, bg=color_can, height=250, width=320, highlightthickness=0) #define a canvas can_scan_1.place(x=440, y=330) #Place the canvas line = can_scan_1.create_line( 0, 62, 320, 62, fill='darkgray') #Draw a line on canvas line = can_scan_1.create_line( 0, 124, 320, 124, fill='darkgray') #Draw a line on canvas line = can_scan_1.create_line( 0, 186, 320, 186, fill='darkgray') #Draw a line on canvas line = can_scan_1.create_line( 160, 0, 160, 250, fill='darkgray') #Draw a line on canvas line = can_scan_1.create_line( 80, 0, 80, 250, fill='darkgray') #Draw a line on canvas line = can_scan_1.create_line( 240, 0, 240, 250, fill='darkgray') #Draw a line on canvas x_range = var_x_scan.get( ) #Get the value of scan range from IntVar for i in range(0, len(dis_list) ): #Scale the result to the size as canvas try: len_dis_1 = int((dis_list[i] / x_range) * 250) #600 is the height of canvas pos = int((i / len(dis_list)) * 320) #740 is the width of canvas pos_ra = int( ((i / len(dis_list)) * 140) + 20) #Scale the direction range to (20-160) len_dis = int(len_dis_1 * (math.sin(math.radians(pos_ra))) ) #len_dis is the height of the line x0_l, y0_l, x1_l, y1_l = pos, ( 250 - len_dis), pos, (250 - len_dis ) #The position of line x0, y0, x1, y1 = (pos + 3), (250 - len_dis + 3), (pos - 3), ( 250 - len_dis - 3 ) #The position of arc if pos <= 160: #Scale the whole picture to a shape of sector pos = 160 - abs( int(len_dis_1 * (math.cos(math.radians(pos_ra))))) x1_l = (x1_l - math.cos(math.radians(pos_ra)) * 130) else: pos = abs( int(len_dis_1 * (math.cos( math.radians(pos_ra))))) + 160 x1_l = x1_l + abs( math.cos(math.radians(pos_ra)) * 130) y1_l = y1_l - abs( math.sin(math.radians(pos_ra)) * 130) #Orientation of line line = can_scan_1.create_line( pos, y0_l, x1_l, y1_l, fill=color_line) #Draw a line on canvas point_scan = can_scan_1.create_oval( (pos + 3), y0, (pos - 3), y1, fill=color_oval, outline=color_oval) #Draw a arc on canvas except: pass can_tex_11 = can_scan_1.create_text( (27, 178), text='%sm' % round((x_range / 4), 2), fill='#aeea00') #Create a text on canvas can_tex_12 = can_scan_1.create_text( (27, 116), text='%sm' % round((x_range / 2), 2), fill='#aeea00') #Create a text on canvas can_tex_13 = can_scan_1.create_text( (27, 54), text='%sm' % round((x_range * 0.75), 2), fill='#aeea00') #Create a text on canvas elif '1' in str(code_car): #Translate the code to text l_ip.config( text='Moving Forward') #Put the text on the label elif '2' in str(code_car): #Translate the code to text l_ip.config( text='Moving Backward') #Put the text on the label elif '3' in str(code_car): #Translate the code to text l_ip.config( text='Turning Left') #Put the text on the label elif '4' in str(code_car): #Translate the code to text l_ip.config( text='Turning Right') #Put the text on the label elif '5' in str(code_car): #Translate the code to text l_ip.config(text='Look Up') #Put the text on the label elif '6' in str(code_car): #Translate the code to text l_ip.config(text='Look Down') #Put the text on the label elif '7' in str(code_car): #Translate the code to text l_ip.config(text='Look Left') #Put the text on the label elif '8' in str(code_car): #Translate the code to text l_ip.config(text='Look Right') #Put the text on the label elif '9' in str(code_car): #Translate the code to text l_ip.config(text='Stop') #Put the text on the label elif '0' in str(code_car): #Translate the code to text l_ip.config( text='Follow Mode On') #Put the text on the label Btn5.config(text='Following', fg='#0277BD', bg='#BBDEFB') auto_status = 1 elif 'findline' in str(code_car): #Translate the code to text BtnFL.config(text='Finding', fg='#0277BD', bg='#BBDEFB') l_ip.config(text='Find Line') findline_status = 1 elif 'lightsON' in str(code_car): #Translate the code to text BtnLED.config(text='Lights ON', fg='#0277BD', bg='#BBDEFB') led_status = 1 l_ip.config(text='Lights On') #Put the text on the label elif 'lightsOFF' in str(code_car): #Translate the code to text BtnLED.config(text='Lights OFF', fg=color_text, bg=color_btn) led_status = 0 l_ip.config(text='Lights OFF') #Put the text on the label elif 'oncvon' in str(code_car): if TestMode == 0: BtnOCV.config(text='OpenCV ON', fg='#0277BD', bg='#BBDEFB') BtnFL.config(text='Find Line', fg=color_text, bg=color_btn) l_ip.config(text='OpenCV ON') opencv_status = 1 elif 'auto_status_off' in str(code_car): if TestMode == 0: BtnSR3.config(fg=color_text, bg=color_btn, state='normal') BtnOCV.config(text='OpenCV', fg=color_text, bg=color_btn, state='normal') BtnFL.config(text='Find Line', fg=color_text, bg=color_btn) Btn5.config(text='Follow', fg=color_text, bg=color_btn, state='normal') findline_status = 0 speech_status = 0 opencv_status = 0 auto_status = 0 elif 'voice_3' in str(code_car): BtnSR3.config(fg='#0277BD', bg='#BBDEFB') #BtnSR1.config(state='disabled') #BtnSR2.config(state='disabled') l_ip.config(text='Sphinx SR') #Put the text on the label speech_status = 1 elif 'TestVersion' in str(code_car): TestMode = 1 BtnSR3.config(fg='#FFFFFF', bg='#F44336') BtnOCV.config(fg='#FFFFFF', bg='#F44336') s1 = tk.Scale( root, label=" < Slow Speed Adjustment Fast >", from_=0.4, to=1, orient=tk.HORIZONTAL, length=400, showvalue=0.1, tickinterval=0.1, resolution=0.2, variable=var_spd, fg=color_text, bg=color_bg, highlightthickness=0) s1.place(x=200, y=100) #Define a Scale and put it in position s3 = tk.Scale(root, label="< Near Scan Range Adjustment(Meter(s)) Far >", from_=1, to=5, orient=tk.HORIZONTAL, length=300, showvalue=1, tickinterval=1, resolution=1, variable=var_x_scan, fg=color_text, bg=color_bg, highlightthickness=0) s3.place(x=30, y=320) l_ip = tk.Label(root, width=18, text='Status', fg=color_text, bg=color_btn) l_ip.place(x=30, y=110) #Define a Label and put it in position l_ip_2 = tk.Label(root, width=18, text='Speed:%s' % (var_spd.get()), fg=color_text, bg=color_btn) l_ip_2.place(x=30, y=145) #Define a Label and put it in position l_ip_4 = tk.Label(root, width=18, text='Disconnected', fg=color_text, bg='#F44336') l_ip_4.place(x=637, y=110) #Define a Label and put it in position l_ip_5 = tk.Label(root, width=18, text='Use default IP', fg=color_text, bg=color_btn) l_ip_5.place(x=637, y=145) #Define a Label and put it in position l_inter = tk.Label( root, width=45, text= '< Car Adjustment Camera Adjustment>\nW:Move Forward Look Up:I\nS:Move Backward Look Down:K\nA:Turn Left Turn Left:J\nD:Turn Right Turn Right:L\nZ:Auto Mode On Look Forward:H\nC:Auto Mode Off Ultrasdonic Scan:X', fg='#212121', bg='#90a4ae') l_inter.place(x=240, y=180) #Define a Label and put it in position E1 = tk.Entry(root, show=None, width=16, bg="#37474F", fg='#eceff1') E1.place(x=170, y=40) #Define a Entry and put it in position l_ip_3 = tk.Label(root, width=10, text='IP Address:', fg=color_text, bg='#000000') l_ip_3.place(x=165, y=15) #Define a Label and put it in position Btn14 = tk.Button(root, width=8, text='Connect', fg=color_text, bg=color_btn, command=connect_2, relief='ridge') Btn14.place(x=300, y=35) #Define a Button and put it in position BtnVIN = tk.Button(root, width=15, text='Voice Input', fg=color_text, bg=color_btn, relief='ridge') BtnVIN.place(x=30, y=495) l_VIN = tk.Label(root, width=16, text='Voice commands', fg=color_text, bg=color_btn) l_VIN.place(x=30, y=465) #Define buttons and put these in position Btn0 = tk.Button(root, width=8, text='Forward', fg=color_text, bg=color_btn, relief='ridge') Btn1 = tk.Button(root, width=8, text='Backward', fg=color_text, bg=color_btn, relief='ridge') Btn2 = tk.Button(root, width=8, text='Left', fg=color_text, bg=color_btn, relief='ridge') Btn3 = tk.Button(root, width=8, text='Right', fg=color_text, bg=color_btn, relief='ridge') Btn4 = tk.Button(root, width=8, text='Stop', fg=color_text, bg=color_btn, relief='ridge') Btn5 = tk.Button(root, width=8, text='Follow', fg=color_text, bg=color_btn, relief='ridge') Btn6 = tk.Button(root, width=8, text='Left', fg=color_text, bg=color_btn, relief='ridge') Btn7 = tk.Button(root, width=8, text='Right', fg=color_text, bg=color_btn, relief='ridge') Btn8 = tk.Button(root, width=8, text='Down', fg=color_text, bg=color_btn, relief='ridge') Btn9 = tk.Button(root, width=8, text='Up', fg=color_text, bg=color_btn, relief='ridge') Btn10 = tk.Button(root, width=8, text='Home', fg=color_text, bg=color_btn, relief='ridge') Btn11 = tk.Button(root, width=8, text='Exit', fg=color_text, bg=color_btn, relief='ridge') Btn12 = tk.Button(root, width=8, text='Set', command=spd_set, fg=color_text, bg=color_btn, relief='ridge') Btn13 = tk.Button(root, width=8, height=3, text='Scan', fg=color_text, bg=color_btn, relief='ridge') Btn0.place(x=100, y=195) Btn1.place(x=100, y=230) Btn2.place(x=30, y=230) Btn3.place(x=170, y=230) Btn4.place(x=170, y=275) Btn5.place(x=30, y=275) Btn6.place(x=565, y=230) Btn7.place(x=705, y=230) Btn8.place(x=635, y=265) Btn9.place(x=635, y=195) Btn10.place(x=635, y=230) Btn11.place(x=705, y=10) Btn12.place(x=535, y=107) Btn13.place(x=350, y=330) # Bind the buttons with the corresponding callback function Btn0.bind('<ButtonPress-1>', call_forward) Btn1.bind('<ButtonPress-1>', call_back) Btn2.bind('<ButtonPress-1>', click_call_Left) Btn3.bind('<ButtonPress-1>', click_call_Right) Btn4.bind('<ButtonPress-1>', call_Stop) Btn5.bind('<ButtonPress-1>', call_auto) Btn6.bind('<ButtonPress-1>', call_look_left) Btn7.bind('<ButtonPress-1>', call_look_right) Btn8.bind('<ButtonPress-1>', call_look_down) Btn9.bind('<ButtonPress-1>', call_look_up) Btn10.bind('<ButtonPress-1>', call_ahead) Btn11.bind('<ButtonPress-1>', call_exit) Btn13.bind('<ButtonPress-1>', scan) Btn0.bind('<ButtonRelease-1>', call_stop) Btn1.bind('<ButtonRelease-1>', call_stop) Btn2.bind('<ButtonRelease-1>', call_stop) Btn3.bind('<ButtonRelease-1>', call_stop) Btn4.bind('<ButtonRelease-1>', call_stop) BtnC1.bind('<ButtonPress-1>', EC1_set) BtnC2.bind('<ButtonPress-1>', EC2_set) BtnM1.bind('<ButtonPress-1>', EM1_set) BtnM2.bind('<ButtonPress-1>', EM2_set) BtnT1.bind('<ButtonPress-1>', ET1_set) BtnT2.bind('<ButtonPress-1>', ET2_set) BtnFL.bind('<ButtonPress-1>', find_line) BtnVIN.bind('<ButtonPress-1>', voice_command) BtnLED.bind('<ButtonPress-1>', lights_ON) # Bind the keys with the corresponding callback function root.bind('<KeyPress-w>', call_forward) root.bind('<KeyPress-a>', call_Left) root.bind('<KeyPress-d>', call_Right) root.bind('<KeyPress-s>', call_back) # When these keys is released,call the function call_stop() root.bind('<KeyRelease-w>', call_stop) root.bind('<KeyRelease-a>', call_stop_2) root.bind('<KeyRelease-d>', call_stop_2) root.bind('<KeyRelease-s>', call_stop) root.bind('<KeyRelease-f>', lights_ON) root.bind('<KeyRelease-e>', find_line) root.bind('<KeyRelease-q>', voice_command) # Press these keyss to call the corresponding function() root.bind('<KeyPress-c>', call_Stop) root.bind('<KeyPress-z>', call_auto) root.bind('<KeyPress-j>', call_look_left) root.bind('<KeyPress-l>', call_look_right) root.bind('<KeyPress-h>', call_ahead) root.bind('<KeyPress-k>', call_look_down) root.bind('<KeyPress-i>', call_look_up) root.bind('<KeyPress-x>', scan) root.bind('<Return>', connect) root.bind('<Shift_L>', call_stop) global stat if stat == 0: # Ensure the mainloop runs only once root.mainloop() # Run the mainloop() stat = 1 # Change the value to '1' so the mainloop() would not run again.
def fill_attendance(): ts = time.time() Date = datetime.datetime.fromtimestamp(ts).strftime('%Y_%m_%d') timeStamp = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S') Time = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S') Hour, Minute, Second = timeStamp.split(":") ####Creatting csv of attendance ##Create table for Attendance date_for_DB = datetime.datetime.fromtimestamp(ts).strftime('%Y_%m_%d') global subb subb=SUB_ENTRY.get() DB_table_name = str(subb + "_" + Date + "_Time_" + Hour + "_" + Minute + "_" + Second) import pymysql.connections ###Connect to the database try: global cursor connection = pymysql.connect(host='localhost', user='******', password='', db='test') cursor = connection.cursor() except Exception as e: print(e) sql = "CREATE TABLE " + DB_table_name + """ (ID INT NOT NULL AUTO_INCREMENT, ENROLLMENT varchar(100) NOT NULL, NAME VARCHAR(50) NOT NULL, DATE VARCHAR(20) NOT NULL, TIME VARCHAR(20) NOT NULL, PRIMARY KEY (ID) ); """ try: cursor.execute(sql) ##for create a table except Exception as ex: print(ex) # if subb=='': err_screen_for_subject() else: sb.destroy() MFW = tk.Tk() MFW.iconbitmap('AMS.ico') MFW.title("Manually attendance of "+ str(subb)) MFW.geometry('880x470') MFW.configure(background='snow') def del_errsc2(): errsc2.destroy() def err_screen1(): global errsc2 errsc2 = tk.Tk() errsc2.geometry('330x100') errsc2.iconbitmap('AMS.ico') errsc2.title('Warning!!') errsc2.configure(background='snow') Label(errsc2, text='Please enter Student & Enrollment!!!', fg='red', bg='white', font=('times', 16, ' bold ')).pack() Button(errsc2, text='OK', command=del_errsc2, fg="black", bg="lawn green", width=9, height=1, activebackground="Red", font=('times', 15, ' bold ')).place(x=90, y=50) def testVal(inStr, acttyp): if acttyp == '1': # insert if not inStr.isdigit(): return False return True ENR = tk.Label(MFW, text="Enter Enrollment", width=15, height=2, fg="white", bg="blue2", font=('times', 15, ' bold ')) ENR.place(x=30, y=100) STU_NAME = tk.Label(MFW, text="Enter Student name", width=15, height=2, fg="white", bg="blue2", font=('times', 15, ' bold ')) STU_NAME.place(x=30, y=200) global ENR_ENTRY ENR_ENTRY = tk.Entry(MFW, width=20,validate='key', bg="yellow", fg="red", font=('times', 23, ' bold ')) ENR_ENTRY['validatecommand'] = (ENR_ENTRY.register(testVal), '%P', '%d') ENR_ENTRY.place(x=290, y=105) def remove_enr(): ENR_ENTRY.delete(first=0, last=22) STUDENT_ENTRY = tk.Entry(MFW, width=20, bg="yellow", fg="red", font=('times', 23, ' bold ')) STUDENT_ENTRY.place(x=290, y=205) def remove_student(): STUDENT_ENTRY.delete(first=0, last=22) ####get important variable def enter_data_DB(): ENROLLMENT = ENR_ENTRY.get() STUDENT = STUDENT_ENTRY.get() if ENROLLMENT=='': err_screen1() elif STUDENT=='': err_screen1() else: time = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S') Hour, Minute, Second = time.split(":") Insert_data = "INSERT INTO " + DB_table_name + " (ID,ENROLLMENT,NAME,DATE,TIME) VALUES (0, %s, %s, %s,%s)" VALUES = (str(ENROLLMENT), str(STUDENT), str(Date), str(time)) try: cursor.execute(Insert_data, VALUES) except Exception as e: print(e) ENR_ENTRY.delete(first=0, last=22) STUDENT_ENTRY.delete(first=0, last=22) def create_csv(): import csv cursor.execute("select * from " + DB_table_name + ";") csv_name='C:/project/attsys/Attendance/Manually Attendance/'+DB_table_name+'.csv' with open(csv_name, "w") as csv_file: csv_writer = csv.writer(csv_file) csv_writer.writerow([i[0] for i in cursor.description]) # write headers csv_writer.writerows(cursor) O="CSV created Successfully" Notifi.configure(text=O, bg="Green", fg="white", width=33, font=('times', 19, 'bold')) Notifi.place(x=180, y=380) import csv import tkinter root = tkinter.Tk() root.title("Attendance of " + subb) root.configure(background='snow') with open(csv_name, newline="") as file: reader = csv.reader(file) r = 0 for col in reader: c = 0 for row in col: # i've added some styling label = tkinter.Label(root, width=13, height=1, fg="black", font=('times', 13, ' bold '), bg="lawn green", text=row, relief=tkinter.RIDGE) label.grid(row=r, column=c) c += 1 r += 1 root.mainloop() Notifi = tk.Label(MFW, text="CSV created Successfully", bg="Green", fg="white", width=33, height=2, font=('times', 19, 'bold')) c1ear_enroll = tk.Button(MFW, text="Clear", command=remove_enr, fg="black", bg="deep pink", width=10, height=1, activebackground="Red", font=('times', 15, ' bold ')) c1ear_enroll.place(x=690, y=100) c1ear_student = tk.Button(MFW, text="Clear", command=remove_student, fg="black", bg="deep pink", width=10, height=1, activebackground="Red", font=('times', 15, ' bold ')) c1ear_student.place(x=690, y=200) DATA_SUB = tk.Button(MFW, text="Enter Data",command=enter_data_DB, fg="black", bg="lime green", width=20, height=2, activebackground="Red", font=('times', 15, ' bold ')) DATA_SUB.place(x=170, y=300) MAKE_CSV = tk.Button(MFW, text="Convert to CSV",command=create_csv, fg="black", bg="red", width=20, height=2, activebackground="Red", font=('times', 15, ' bold ')) MAKE_CSV.place(x=570, y=300) def attf(): import subprocess subprocess.Popen(r'explorer /select,"C:\project\attsys\Attendance\Manually Attendance\-------Check atttendance-------"') attf = tk.Button(MFW, text="Check Sheets",command=attf,fg="black" ,bg="lawn green" ,width=12 ,height=1 ,activebackground = "Red" ,font=('times', 14, ' bold ')) attf.place(x=730, y=410) MFW.mainloop()
import tkinter as tk import time root = tk.Tk() bgLabel = tk.Label(root, bg='#693c1e') textLabel = tk.Label(root, bg='Gray', font=("Veranda", 16), anchor='nw') inputBox = tk.Entry(root, bg='#595959') enterButton = tk.Button(root, bg="#595959", text='ENTER') class EmptyScene(Exception): pass class SceneReturnedNone(Exception): pass class Scene(object): def render(self): print("This scene has not been projected yet") raise EmptyScene() def WaitForInput(self): while True: if enterButton['state'] == 'active': enterButton['state'] = 'normal' break root.update() return inputBox.get() def RenderText(self, in_text: str): i = 0 buffer = ''
def graph_window_visualization_init(self): # FILTERED DATA folder_path_data = tkinter.StringVar() label_data = tkinter.Label( master=self.tab_graph_difference_visualization) label_data.place(x=20, y=20) label_data.config(text="RGW Matrix Results") textfield_data = tkinter.Entry( master=self.tab_graph_difference_visualization, width=100, state='disabled') textfield_data.place(x=140, y=20) browse_button_data = tkinter.Button( master=self.tab_graph_difference_visualization, text="Browse", command=lambda: self.folder_browse_button(folder_path_data, textfield_data)) browse_button_data.place(x=750, y=15) browse_button_data.config(width=10, height=1) # OUTPUT PATH folder_path_output = tkinter.StringVar() label_output = tkinter.Label( master=self.tab_graph_difference_visualization, text="Output path") label_output.place(x=20, y=80) label_output.config(text="Output path") textfield_output = tkinter.Entry( master=self.tab_graph_difference_visualization, width=100, state='disabled') textfield_output.place(x=140, y=80) browse_button_output = tkinter.Button( master=self.tab_graph_difference_visualization, text="Browse", command=lambda: self.folder_browse_button(folder_path_output, textfield_output)) browse_button_output.place(x=750, y=75) browse_button_output.config(width=10, height=1) # TRIAL INDEX label_trial_index = tkinter.Label( master=self.tab_graph_difference_visualization, text="Trial index") label_trial_index.place(x=20, y=140) label_trial_index.config(text="Trial index") textfield_trial_index = tkinter.Entry( master=self.tab_graph_difference_visualization, width=100) textfield_trial_index.place(x=140, y=140) # LOGGING AREA text_area = tkinter.Text(self.tab_graph_difference_visualization, height=10, width=100) text_area.place(x=20, y=220) widget = TextHandler(text_area) # START BUTTON start_button = tkinter.Button( master=self.tab_graph_difference_visualization, text="Start", command=lambda: self.start_graph_difference_visualization( folder_path_data.get(), folder_path_output.get(), textfield_trial_index.get(), widget)) start_button.place(x=375, y=410) start_button.config(width=10, height=1)
def main(self): Frame = ttk.LabelFrame(self, text='Dialogue') Frame.pack(expand=1, fill='both') # creating the entry boxes self.vcmd = (self.register (self.validator ) , '%P' , '%d') self.vcmd2 = (self.register (self.validator3 ) , '%P' , '%d') self.txt1 = tk.Label(Frame, text='Music Id:') self.txt1.place(relx=0.01, rely=0.05) self.txt2 = tk.Label(Frame, text='Artist Id:') self.txt2.place(relx=0.01, rely=0.15) self.id1 = tk.Entry(Frame, width=26, state='disabled',validate = 'key' , validatecommand = self.vcmd2) self.id1.place(relx=0.15, rely=0.05) self.id2 = tk.Entry(Frame, width=26, validate = 'key' , validatecommand = self.vcmd, state='disabled') self.id2.place(relx= 0.15, rely=0.15) # creating the dropdown menu for the metrics #tk.Label(Frame, text='Metric:').place(relx=0.58, rely=0.154) OPTIONS = ['Cosine','Euclidean','Jaccard','manhattan','pearson'] self.metric = tk.StringVar() self.metric.set(OPTIONS[2]) # default value option = tk.OptionMenu(Frame,self.metric, *OPTIONS) option.configure(width=13) option.place(relx= 0.59, rely=0.14) # creating the radiobuttons for choosing the similarites you want to check, either between music id or artists id or artist and music Frame2 = tk.Frame(Frame) Frame2.place(relx=0.01, rely=0.25) tk.Label(Frame, text='Similarites Between').place(relx=0.01, rely=0.25) self.sim_choosen = tk.IntVar() similarities_opt = [('Musics', 1),('Artists', 2),("Artist & Musics",3)] for similarity, val in similarities_opt: tk.Radiobutton(Frame2, text=similarity, variable=self.sim_choosen,command=self.getter ,value=val).pack(side='left', pady=20) # creating the spinbox that would indicate how many no of similarities do want to see.. # this would only work if you are trying to only show the n similarity to an artist or music tk.Label(Frame, text='N:').place(relx=0.58, rely=0.05) self.N = tk.Spinbox ( Frame , from_ = 0 , to = 100 , width = 15, state='disabled') self.N.place(relx= 0.61, rely =0.05) # creating the calculate button button = tk.Button(Frame, text='Calculate Similarity', width=16, command = lambda: [f () for f in [self.validator2]]) button.place(relx = 0.50, rely=0.30) # creating the evalution button self.eval_button = tk.Button(Frame, text='Evaluation', width=10, state='disabled', command=self.evaluate) self.eval_button.place(relx = 0.80, rely=0.30) # progress bar self.progress_Bar = ttk.Progressbar(Frame, orient='horizontal', length=495, mode='determinate') self.progress_Bar.place(relx=0.00, rely=0.53) self.tips = tk.Label(Frame, text='Tips!!') self.tips.place(relx = 0.45, rely=0.44) # result panel tk.Label(Frame, text='Results').place(relx = 0.01, rely=0.62) tk.Label(Frame, text='Similarity Score:').place(relx=0.03, rely=0.72) self.Score = tk.Label(Frame, text='') self.Score.place(relx=0.25, rely=0.72) # creating the text area for displaying results Frame2 = tk.Frame(Frame) Frame2.place(relx=0.50, rely=0.62) h = tk.Scrollbar(Frame2, orient = 'horizontal') h.pack(side ='bottom', fill = 'x') v = tk.Scrollbar(Frame2) v.pack(side = 'right', fill = 'y') self.t = tk.Text(Frame2, width = 33, height = 7.4,xscrollcommand = h.set, yscrollcommand = v.set, state='disabled') self.t.pack(side='top') h.config(command=self.t.xview) v.config(command=self.t.yview)
def start(self): firebase = fb.FirebaseApplication("https://proyectopython2020a-d2866.firebaseio.com/", None) resultados_consulta = firebase.get('/proyectopython2020a-d2866/Usuario', '') flag_credenciales = False for documento in resultados_consulta: usuario = resultados_consulta[documento] if(documento == self.codigo_documento): self.nombre_usuario_var = usuario['nombre_usuario'] self.correo = usuario['correo'] self.fecha_nacimiento_usuario = usuario['fecha_nacimiento'] self.pais_usuario = usuario['pais'] familia_fuente = "Cambria" tamanio_fuente = 12 color_botones = "#A74B94" color_ventana = "#4C2B64" color_titulo_principal = "#0F0D3E" color_texto = "#D8D5F4" ventana = tkinter.Tk() ventana.geometry("460x400") ventana.title("Perfil") ventana.resizable(False,False) ventana.config(background = color_ventana) self.center(ventana) titulo_principal = tkinter.Label(ventana, text="Wing Gundam Zero || Perfil", font=(familia_fuente,15), bg=color_titulo_principal, fg=color_texto) titulo_principal.pack(fill = tkinter.X) advertencia = tkinter.StringVar() label_advertencia = tkinter.Label(ventana, textvariable=advertencia, bg=color_ventana, fg="yellow") label_advertencia.pack() label_nombre_usuario = tkinter.Label(ventana, text="Nombre de Usuario: ", font=(familia_fuente,tamanio_fuente), bg=color_ventana, fg=color_texto) label_nombre_usuario.place(x = 30, y = 70) label_correo_electronico = tkinter.Label(ventana, text="Correo Electronico: ", font=(familia_fuente,tamanio_fuente), bg=color_ventana, fg=color_texto) label_correo_electronico.place(x = 30, y = 120) label_fecha_nacimiento = tkinter.Label(ventana, text="Fecha de Nacimiento: ", font=(familia_fuente,tamanio_fuente), bg=color_ventana, fg=color_texto) label_fecha_nacimiento.place(x = 30, y = 170) label_pais = tkinter.Label(ventana, text="Pais: ", font=(familia_fuente,tamanio_fuente), bg=color_ventana, fg=color_texto) label_pais.place(x = 30, y = 220) nombre_usuario = tkinter.StringVar() nombre_usuario.set(self.nombre_usuario_var) correo_electronico = tkinter.StringVar() correo_electronico.set(self.correo) fecha_nacimiento = tkinter.StringVar() fecha_nacimiento.set(self.fecha_nacimiento_usuario) pais = tkinter.StringVar() pais.set(self.pais_usuario) lista_paises = ["Afganistan", "Albania", "Alemania", "Andorra", "Angola", "Antigua y Barbuda", "Arabia Saudita", "Argelia", "Argentina", "Armenia", "Australia", "Austria", "Azerbaiyan", "Bahamas", "Banglades", "Barbados", "Barein", "Belgica", "Belice", "Benin", "Bielorrusia", "Birmania", "Bolivia", "Botsuana", "Brasil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Butan", "Cabo Verde", "Camboya", "Camerun", "Canada", "Catar", "Chad", "Chile", "China", "Chipre", "Ciudad del Vaticano", "Colombia", "Comoras", "Corea del Norte", "Corea del Sur", "Costa de Marfil", "Costa Rica", "Croacia", "Cuba", "Dinamarca", "Dominica", "Ecuador", "Egipto", "El Salvador", "Emiratos Arabes Unidos", "Eritrea", "Eslovaquia", "Eslovenia", "España", "Estados Unidos", "Estonia", "Etiopía", "Filipinas", "Finlandia", "Fiyi", "Francia", "Gabón", "Gambia", "Georgia", "Ghana", "Granada", "Grecia", "Guatemala", "Guyana", "Guinea", "Haiti", "Honduras", "Hungria", "India", "Indonesia", "Irak", "Iran", "Irlanda", "Islandia", "Isla de los Piratas", "Israel", "Italia", "Jamaica", "Japon", "Jordania", "Kazajistan", "Kenia", "Kirguistan", "Kiribati", "Kuwait", "Laos", "Lesoto", "Letonia", "Libano", "Liberia", "Libia", "Liechtenstein", "Lituania", "Luxemburgo", "Macedonia del Norte", "Madagascar", "Malasia", "Malaui", "Maldivas", "Mali", "Malta", "Marruecos", "Mauricio", "Mauritania", "Mexico", "Micronesia", "Moldavia", "Mordor", "Monaco", "Mongolia", "Montenegro", "Mozambique", "Namibia", "Nauru", "Nepal", "Nicaragua", "Níger", "Nigeria", "Noruega", "Nueva Zelanda", "Oman", "Paises Bajos", "Pakistan", "Palaos", "Panama", "Papua Nueva Guinea", "Paraguay", "Peru", "Polonia", "Portugal", "Reino Unido", "Republica Dominicana", "Ruanda", "Rumania", "Rusia", "Samoa", "San Marino", "Santa Lucia", "Senegal", "Serbia", "Seychelles", "Sierra Leona", "Singapur", "Siria", "Somalia", "Suazilandia", "Sudáfrica", "Sudán", "Sudán del Sur", "Suecia", "Suiza", "Surinam", "Tailandia", "Tanzania", "Takoshima", "Timor Oriental", "Togo", "Tonga", "Trinidad y Tobago", "Tunez", "Turkmenistán", "Turquía", "Tuvalu", "Ucrania", "Uganda", "Uruguay", "Uzbekistán", "Vanuatu", "Venezuela", "Vietnam", "Yemen", "Yibuti", "Zambia", "Zimbabue"] entry_nombre_usuario = tkinter.Entry(ventana, textvariable=nombre_usuario, width="30") nombre_usuario.trace("w", lambda *args: self.limitador(nombre_usuario, 10)) entry_nombre_usuario.place(x = 250, y = 70) entry_correo_electronico = tkinter.Entry(ventana, textvariable=correo_electronico, width="30") entry_correo_electronico.place(x = 250, y = 120) entry_fecha_nacimiento = tkinter.Entry(ventana, textvariable=fecha_nacimiento, width="30") fecha_nacimiento.trace("w", lambda *args: self.limitador(fecha_nacimiento, 10)) entry_fecha_nacimiento.place(x = 250, y = 170) options_paises = tkinter.OptionMenu(ventana, pais, *lista_paises) options_paises.place(x = 250, y = 220) boton_cerrar = tkinter.Button(ventana, text="Cerrar", font=(familia_fuente,tamanio_fuente), width="19", bg="#A74B94", fg=color_texto, command = lambda: self.cerrar(ventana)) boton_cerrar.place(x = 30, y = 280) boton_actualizar = tkinter.Button(ventana, text="Actualizar Datos", font=(familia_fuente,tamanio_fuente), width="19", bg=color_botones, fg=color_texto, command = lambda: self.actualizar(nombre_usuario.get(), correo_electronico.get(), fecha_nacimiento.get(), pais.get(), advertencia, ventana)) boton_actualizar.place(x = 250, y = 280) ventana.mainloop()
OptionList = ["Apriori", "FP-Growth"] root = tk.Tk() canvas1 = tk.Canvas(root, width=800, height=700, relief='raised') canvas1.pack() canvas1.configure(background='white') label1 = tk.Label(root, text='Market Basket Analysis') label1.config(font=('helvetica', 14), bg="white") canvas1.create_window(400, 25, window=label1) label2 = tk.Label(root, text='File Location') label2.config(font=('helvetica', 10), bg='white') canvas1.create_window(120, 70, window=label2) entry1 = tk.Entry(root) canvas1.create_window(280, 70, window=entry1) label3 = tk.Label(root, text='Algorithm') label3.config(font=('helvetica', 10), bg='white') canvas1.create_window(500, 70, window=label3) variable = tk.StringVar(root) variable.set(OptionList[0]) opt = tk.OptionMenu(root, variable, *OptionList) opt.config(width=12, font=('Helvetica', 10)) canvas1.create_window(660, 75, window=opt) label4 = tk.Label(root, text='Support') label4.config(font=('helvetica', 10), bg='white')