def MasterFunction(): MasterWindow = Tk() MasterWindow.title("Self Destruct") MasterWindow.geometry("1920x1080") def UserName(): global StoredName Canvas(MasterWindow, width=1920, height=1080, bg = "snow").place(x = 0, y = 0) StoredName = StringVar() NameLabel = Label(text = "Please enter your name", bg = "snow", font = font2) NameLabel.pack() NameEntryBox = Entry(bd = 4, textvariable = StoredName, bg = "snow", font = font2) NameEntryBox.pack() ButtonName = Button(text = "Continue", font = font2, bg = "snow", command = ChangeThis) ButtonName.pack() def ChangeThis(): label1 = Label(text = StoredName, bg = "snow", font = font2) label1.pack() def Menu(): #The first window the user sees. Canvas(width = 1920, height = 1080, bg = "snow").place(x = 0, y = 0) TitleMain = Label(MasterWindow, text = "Self Destruct", font = font1, fg = "deep sky blue", bg = "snow").place( x = 845, y = 1) ButtonStart = Button(MasterWindow, text = "Start", font = font2, fg = "deep sky blue", bg = "snow", command = UserName).place( x = 909, y = 60) ButtonExit = Button(MasterWindow, text ="Exit", font = font2, fg = "deep sky blue", bg = "snow", command = exit).place( x = 915, y = 130) Menu()
def Creditos(): Ventana1 = Tk() Ventana1.title("Créditos") Ventana1.geometry("500x200") Ventana1.resizable(width=False, height=False) im = Image.open("Info/proteco.png") im = im.resize((100, 100), Image.ANTIALIAS) ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=20, y=20) MARIO = Label(Ventana1, text="Mario Alberto Vásquez Cancino ").place(x=140, y=35) MARIO1 = Label(Ventana1, text="Becario PROTECO Generación 37").place(x=160, y=55) MARIO2 = Label(Ventana1, text="Unánse al programa está super padre :)").place(x=140, y=75) PROTECO = Label(Ventana1, text="Info en Facebook: Proteco").place(x=160, y=95) RAUL = Label( Ventana1, text="Agradecimientos especiales a Raul E. Lopez Briega:").place(x=20, y=140) RAUL1 = Label( Ventana1, text="-Por tan buen blog, base para poder realizar este programa." ).place(x=40, y=160) Ventana1.mainloop()
def InfoNor(): Ventana1 = Tk() Ventana1.title("Distribución Normal") Ventana1.geometry("965x290") Ventana1.resizable(width=False, height=False) im = Image.open("Info/nor.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Ventana1.mainloop()
def InfoHiper(): Ventana1 = Tk() Ventana1.title("Distribución Hipergeométrica") Ventana1.geometry("985x535") Ventana1.resizable(width=False, height=False) im = Image.open("Info/hiper.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Ventana1.mainloop()
def InfoPoi(): Ventana1 = Tk() Ventana1.title("Distribución Poisson") Ventana1.geometry("980x400") Ventana1.resizable(width=False, height=False) im = Image.open("Info/poi.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Ventana1.mainloop()
def InfoExp(): Ventana1 = Tk() Ventana1.title("Distribución Exponencial") Ventana1.geometry("960x284") Ventana1.resizable(width=False, height=False) im = Image.open("Info/exp.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Exponencial() Ventana1.mainloop()
def InfoUni(): Ventana1 = Tk() Ventana1.title("Distribución Uniforme") Ventana1.geometry("730x445") Ventana1.resizable(width=False, height=False) im = Image.open("Info/uni.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Uniforme() Ventana1.mainloop()
def InfoBer(): Ventana1 = Tk() Ventana1.title("Distribución Bernoulli") Ventana1.geometry("964x345") Ventana1.resizable(width=False, height=False) im = Image.open("Info/ber.png") ph = ImageTk.PhotoImage(im, master=Ventana1) label = Label(Ventana1, image=ph).place(x=0, y=0) Bernoulli() Ventana1.mainloop()
def MasterFunction(): MasterWindow = Tk() MasterWindow.title("Self Destruct") MasterWindow.geometry("1920x1080") def UserName(): global StoredName Canvas(MasterWindow, width=1920, height=1080, bg="snow").place(x=0, y=0) StoredName = StringVar() NameLabel = Label(text="Please enter your name", bg="snow", font=font2) NameLabel.pack() NameEntryBox = Entry(bd=4, textvariable=StoredName, bg="snow", font=font2) NameEntryBox.pack() ButtonName = Button(text="Continue", font=font2, bg="snow", command=ChangeThis) ButtonName.pack() def ChangeThis(): label1 = Label(text=StoredName, bg="snow", font=font2) label1.pack() def Menu(): #The first window the user sees. Canvas(width=1920, height=1080, bg="snow").place(x=0, y=0) TitleMain = Label(MasterWindow, text="Self Destruct", font=font1, fg="deep sky blue", bg="snow").place(x=845, y=1) ButtonStart = Button(MasterWindow, text="Start", font=font2, fg="deep sky blue", bg="snow", command=UserName).place(x=909, y=60) ButtonExit = Button(MasterWindow, text="Exit", font=font2, fg="deep sky blue", bg="snow", command=exit).place(x=915, y=130) Menu()
def chamarTelaListaMusicas(): janela = Tk() janela.title("Lista de Músicas") telaL = 500 telaA = 400 telaLargura = janela.winfo_screenwidth() telaAltura = janela.winfo_screenheight() x = (telaLargura / 2) - (telaL / 2) y = (telaAltura / 2) - (telaA / 2) janela.geometry("%dx%d+%d+%d" % (telaL, telaA, x, y)) janela.iconbitmap("icones/icon_player.ico") for i in range(len(lista)): Label(text='- ' + lista[i]).pack() janela.mainloop()
def add_user(): root1 = Tk() root1.title("User Registration") Label(root1, text="Employee Name", font=('eras bold itc', 12)).grid(row=0, sticky=W) Label(root1, text="Employee ID", font=('eras bold itc', 12)).grid(row=1, sticky=W) Label(root1, text="Age", font=('eras bold itc', 12)).grid(row=2, sticky=W) Label(root1, text="Department", font=('eras bold itc', 12)).grid(row=3, sticky=W) Label(root1, text="Phone Number", font=('eras bold itc', 12)).grid(row=4, sticky=W) Fname = Entry(root1) Fname.grid(row=0, column=1) id = Entry(root1) id.grid(row=1, column=1) age = Entry(root1) age.grid(row=2, column=1) dept = Entry(root1) dept.grid(row=3, column=1) phone = Entry(root1) phone.grid(row=4, column=1) root1.grid_columnconfigure(1, minsize=150) root1.geometry("290x160") def getInput(): global params1 global params2 global params3 global params4 global params5 params1 = Fname.get() params2 = id.get() params3 = age.get() params4 = dept.get() params5 = phone.get() root1.destroy() Button(root1, text="Submit", font=('cooper black', 12), command=lambda: [getInput(), capture()]).grid(row=5, sticky=W) root1.mainloop()
def adicionarMusica(): global listaNomes, opcoes, lista, musica_e, z, fundo, cor_fundo_escolhida, botao_play, valor_play_pause jatem = False root = Tk() root.geometry('0x0') root.overrideredirect(False) root.iconbitmap('icones\icon_player.ico') opcoes['defaultextension'] = '.mp3' opcoes['filetypes'] = [('arquivos .mp3', '.mp3')] opcoes['initialdir'] = '' # será o diretório atual opcoes['initialfile'] = '' #apresenta todos os arquivos no diretorio opcoes['title'] = 'Selecione a música' nome_musica = askopenfile(mode='r', **opcoes) root.destroy() root.mainloop() try: fundo.fill(cor_fundo_escolhida) d = nome_musica.name f = d.split('/') w = f[len(f) - 1] w = w.split('.') if d in listaNomes: pyautogui.alert(text='A música \"' + w[0] + '\" já encontra-se na lista!', title='', button='OK') listaNomes = listaNomes lista = lista jatem = True else: try: pygame.mixer.music.load(d) pygame.mixer.music.play() listaNomes.append(nome_musica.name) lista.append(w[0]) musica_e = w[0] z = len(lista) - 1 except: pyautogui.alert(text='Não foi possível reproduzir a música!', title='Erro', button='OK') if valor_play_pause == 1 and jatem == False: botao_play = pygame.image.load("icones\icon_play_pause.png") valor_play_pause = 0 except AttributeError as error: listaNomes = listaNomes lista = lista salvarLista()
def chamarTelaListaMusicas(): janela = Tk() janela.title("Lista de Músicas") telaL = 500 telaA = 400 telaLargura = janela.winfo_screenwidth() telaAltura = janela.winfo_screenheight() x = (telaLargura / 2) - (telaL / 2) y = (telaAltura / 2) - (telaA / 2) janela.geometry("%dx%d+%d+%d" % (telaL, telaA, x, y)) janela.iconbitmap( "C:/Users/Romão/PycharmProjects/Exercicios-Python/exercicios/icone.ico" ) for i in range(len(lista)): Label(text='- ' + lista[i]).pack() janela.mainloop()
def mainloop(file): global window global entry global txt global author global send_to send_to = None author = file sock = socket.socket() sock.connect(('25.95.4.168', 10001)) sock.send((file + ' connect').encode('utf-8')) data = sock.recv(1024).decode('utf-8') sock.close() window = Tk() window.resizable(False, False) window.title(file) window.geometry("800x800") while True: quit_btn = Button(window, text="Выйти", command=quit, bg="red") send_btn = Button(window, text="Отправить", command=send, bg="green") data = data.replace(file, "") accounts = data.split() frame = Frame(window) frame.place(x=200, y=0, width=600, height=600) txt = Text(frame, width=580, height=600, wrap=NONE, state=DISABLED) txt.pack(side="left") n = 0 for i in accounts: funk = partial(update, file, i) Button(window, command=funk, text=i).place(x=0, y=n * 120, width=200, height=120) n += 1 scroll = Scrollbar(frame, command=txt.yview, orient=VERTICAL, width=20) scroll.pack(side=RIGHT, fill=Y) txt.config(yscrollcommand=scroll.set) entry = Entry(window) quit_btn.place(x=200, y=695, width=100, height=50) send_btn.place(x=500, y=695, width=100, height=50) entry.place(x=200, y=600, width=600, height=40) window.mainloop() update(file, send_to)
def start(): window = Tk() window.title('BattleShips with AI') window.geometry('500x500') menu = Menu(window) new_item = Menu(menu) new_item.add_command(label='New') new_item.add_command(label='Exit') menu.add_cascade(label='File', menu=new_item) window.config(menu=menu) lbl = Label(window, text='Enter your positions', font=('Helvetica', 25)) lbl.grid(column=0, row=0) ship5 = Entry(window, width=6) ship5.grid(column=1, row=0) ship4 = Entry(window, width=6) ship4.grid(column=1, row=1) ship3_1 = Entry(window, width=6) ship3_1.grid(column=1, row=2) ship3_2 = Entry(window, width=6) ship3_2.grid(column=1, row=3) ship2 = Entry(window, width=6) ship2.grid(column=1, row=4)
print(metrics.accuracy_score(y_test, prediction)) # In[19]: import tkinter as Tk import tkinter from tkinter import * # In[39]: top=Tk() top.geometry('1600x800+0+0') top.configure(background='orange') variable = StringVar(top) variable.set("1") # default value variable = StringVar(top) variable.set("1") # default value tkinter.Label(top, text='Soils:', bg='orange',fg='black', font='none 12 bold').grid(row=1,column=0,sticky=W) w = OptionMenu(top, variable,"1","2","3","4","5","6").grid(row=1, column=1,sticky=W) tkinter.Label(top, text='Month:', bg='orange',fg='black', font='none 12 bold').grid(row=2,column=0,sticky=W) w = OptionMenu(top, variable,"1","2","3","4","5","6").grid(row=2, column=1,sticky=W) variable = StringVar(top)
lb3.config(text=str("Current Weather Description:" + str(weather_desc))) lb4.config(text=str("Current Humidity :" + str(hmdt) + "%")) lb5.config(text=str( "Current Temperature is: {:.2f}\N{DEGREE SIGN}C ".format(temp_city))) lb6.config(text=str("Current Wind Speed:" + str(wnd_spd) + "kmph")) if temp_city > 15: master.configure(bg="orange") else: master.configure(bg="powder blue") master = Tk() master.title('Weather App') master.config(bg="cadet blue", relief="solid") master.geometry("700x600") lbheading = Label(master, text="My Weather App", font="arial 22 bold", bg='powderblue') lbheading.pack() lb1 = Label(master, text="Enter City:", font='arial 18 bold') lb1.pack(pady=20) en1 = Entry(master) en1.pack(pady=20) checkbutton = Button(master, text="Search", font="bold", command=weather_app) checkbutton.pack(pady=20)
MotAffiche.pop(2 * k) MotAffiche.insert(2 * k, x) if m == 0: chances += -1 else: score += m print(TransfoListeChaine(MotAffiche)) print("Nombre de vies restantes : " + str(chances)) else: print("La lettre choisie a déjà été demandée") print(TransfoListeChaine(MotAffiche)) NewFenetre = Tk() NewFenetre.title('Le Pendu') NewFenetre.geometry('400x400+400+400') BoutonLancer = Button(NewFenetre, text='Jouer', command=lambda: Afficher_(MotRandom())) BoutonLancer.pack(side=LEFT, padx=4, pady=4) NewFenetre.mainloop() BoutonInstruction = Button(NewFenetre, text='Instructions', command=Regle) BoutonInstruction.pack(side=LEFT, padx=4, pady=4) BoutonQuitter = Button(NewFenetre, text='Quitter', command=NewFenetre.destroy) BoutonQuitter.pack(side=LEFT, padx=4, pady=4) BoutonRejouer = Button(NewFenetre, text='Rejouer', command=Regle) BoutonRejouer.pack(side=LEFT, padx=4, pady=4) NewFenetre.mainloop()
def Create(): root=Tk() root.geometry("700x500") f2=Frame(root) f3=Frame(root) def menu1(): class Admin(Frame): def __init__(self, parent): self.parent=parent self.initialize_user_interface() def create(self): global i i=1 self.tree.delete(*self.tree.get_children()) cursor.execute("select * from movie") results = cursor.fetchall() for row in results: x = row[0] y=row[1] z=row[2] valuelist = [y,z,x] i=i+1 self.tree.insert('', 'end',values=(valuelist), tags='cold',text=x) def initialize_user_interface(self): global selected global selected2 global selected3 self.parent.grid_rowconfigure(0,weight=1) self.parent.grid_columnconfigure(0,weight=1) self.parent.config(background="lavender") self.dose_label =Label(self.parent ,text = "Movie Name") self.dose_entry = Entry(self.parent) self.dose_label.place(x=50,y=10) self.dose_entry.place(x=250,y=10) self.dose_label2 =Label(self.parent ,text = "Date",width=20) self.dose_label2.place(x=50,y=40) options = ["2018","2019","2020","2021","2022","2023","2024","2025","2026"] selected = StringVar(value="Year") op=OptionMenu(self.parent, selected, *(options)) op.place(x=250,y=40) options2 = ["1","2","3","4","5","6","7","8","9","10","11","12"] selected2 = StringVar(value="Month") op2 = OptionMenu(self.parent, selected2, *(options2)) op2.place(x=320,y=40) op2.config(width=5) options3 = ['1','2','3','4','5','6','7''8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'] selected3 = StringVar(value="Date") op3 = OptionMenu(self.parent, selected3, *(options3)) op3.place(x=400,y=40) self.submit_button = Button(self.parent, text = "Insert", bd=4,command = self.insert_data) self.submit_button.place(x=250,y=100) self.b=Button(self.parent, fg='blue',text="Update",bd=4,command=up1).place(x=300,y=100) # Set the treeview self.tree = ttk.Treeview( self.parent, columns=('Movie', 'date')) self.tree.heading('#0', text='ID') self.tree.heading('#1', text='movie') self.tree.heading('#2', text='Date') self.tree.column('#1', stretch=YES) self.tree.column('#2', stretch=YES) self.tree.column('#0', stretch=YES) self.tree.place(x=10,y=130) self.treeview = self.tree self.create() # Initialize the counter self.i = 0 def insert_data(self): self.treeview.insert('', 'end', text=""+str(i), values=(self.dose_entry.get(),str(selected.get()+"-"+selected2.get()+"-"+selected3.get()))) a=str(selected.get()+"-"+selected2.get()+"-"+selected3.get()) b=self.dose_entry.get() cursor.execute("""INSERT INTO movie VALUES (%d,'%s','%s')"""%(i,b,a)) row= cursor.fetchone() conn.commit() def retur(self): a=str(selected.get()+"-"+selected2.get()+"-"+selected3.get()) b=self.dose_entry.get() l=list(a,b) return(l) def main(): f2.pack(fill=BOTH, expand=1) d=Admin(f2) root.mainloop() if __name__=="__main__": main() def menu4(): c.delete("all") c.create_rectangle(200,25,700,150,fill="Red") label1.config(text="It is a rectangle ") def det(): top=Tk() dose_label =Label(top ,text = "Movie Name") dose_entry = Entry(top) dose_label.place(x=0,y=10) dose_entry.place(x=90,y=10) modified_label = Label(top, text = "ID ") modified_entry =Entry(top) modified_label.place(x=0,y=60) modified_entry.place(x=90,y=60) b3=Button(top, fg='blue',text="Delete",bd=4).place(x=30,y=90) def up1(*args): def up12(): cursor.execute("update movie set movie_nm='%s' , movie_date='%s' where movie_id=%d"%(b,a,int(modified_entry.get()))) row= cursor.fetchone() dose_label =Label(root,text = "Movie Name") dose_entry = Entry(root) dose_label.place(x=50,y=10) dose_entry.place(x=250,y=10) dose_label2 =Label(root ,text = "Date",width=20) dose_label2.place(x=50,y=40) options = ["2018","2019","2020","2021","2022","2023","2024","2025","2026"] selected = StringVar(value="Year") op=OptionMenu(root, selected, *(options)) op.place(x=250,y=40) options2 = ["1","2","3","4","5","6","7","8","9","10","11","12"] selected2 = StringVar(value="Month") op2 = OptionMenu(root, selected2, *(options2)) op2.place(x=320,y=40) op2.config(width=5) options3 = ['1','2','3','4','5','6','7''8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'] selected3 = StringVar(value="Date") op3 = OptionMenu(root, selected3, *(options3)) op3.place(x=400,y=40) b2=Button(root ,fg='blue',text=" DATE ",bd=4,command=up12).place(x=300,y=100) modified_label = Label(root, text = "ID ") modified_entry =Entry(root) modified_label.place(x=50,y=80) modified_entry.place(x=250,y=80) a=str(selected.get()+"-"+selected2.get()+"-"+selected3.get()) b=dose_entry.get() def user(): class user_det(Frame): def create(self): a=[] self.tree.delete(*self.tree.get_children()) cursor.execute("select ID from user") results = cursor.fetchall() cursor.execute("select usr_ID from user_mov") row = cursor.fetchall() k=0 for i in results: if i in row: a.append(1) else: a.append(0) for i in range(len(a)): w=i+1 cursor.execute("select user_nm from user where ID=%d"%w) rp = cursor.fetchone() if a[i]==1: z=i+1 cursor.execute("select movie_id,thea_nm from user_mov where usr_ID=%d"%z) results = cursor.fetchone() r=results[0] cursor.execute("select movie_dt from movie where movie_id=%d"%r) rk = cursor.fetchone() p=results[1] cursor.execute("select movie_nm from movie where movie_id=%d"%(int(r))) x= cursor.fetchone() self.tree.insert('', 'end', text="", values=(rp,x,rk,p)) else: self.tree.insert('', 'end', text="", values=(rp,'NOT BOOK','NOT BOOK','NOT BOOK')) def __init__(self, parent): self.parent=parent self.initialize_user_interface() def initialize_user_interface(self): self.parent.grid_rowconfigure(0,weight=1) self.parent.grid_columnconfigure(0,weight=1) self.parent.config(background="lavender") win2 = Toplevel() new_element_header=['1st','2nd','3rd','4th'] treeScroll = ttk.Scrollbar(win2) treeScroll.pack(side=RIGHT, fill=Y) self.tree = ttk.Treeview(win2,columns=new_element_header, show="headings", yscrollcommand = treeScroll) self.tree.heading('#0', text='Item') self.tree.heading('#1', text='User name') self.tree.heading('#2', text='Movie') self.tree.heading('#3', text='Date') self.tree.heading('#4', text='Theater') self.create() self.tree.pack(side=LEFT, fill=BOTH) # Initialize the counter self.i = 0 def insert_data(self): self.treeview.insert('', 'end', text="Item_"+str(self.i), values=(self.dose_entry.get()+" mg", self.modified_entry.get())) self.i = self.i + 1 def main(): root.geometry("500x500") f3.pack(fill=BOTH, expand=1) d= user_det(f3) root.mainloop() if __name__=="__main__": main() def log(): root.destroy() menubar=Menu(root) menubar=Menu(root) filename1=Menu(menubar) filename2=Menu(menubar) filename1.add_command(label="INSERT",command=menu1) filename1.add_command(label="Delete",command=det) filename2.add_command(label="SHOW USER",command=user) menubar.add_cascade(label="MOVIE",menu=filename1) menubar.add_cascade(label="USER",menu=filename2) menubar.add_cascade(label="LOGOUT",command=log) root.config(menu=menubar) root.mainloop() root.mainloop()
app.mainloop() #root.destroy() #biimg = PhotoImage(file="bw_image.png") #Label (win9, image=biimg) .grid(row=0,column=0,sticky=E) #label4 = Label(image=biimg) #label4.image = biimg # keep a reference! #label4.pack() # main window = Tk() window.title("Rice Quality Analyser") width = window.winfo_screenwidth() height = window.winfo_screenheight() window.geometry('%sx%s' % (width, height)) #window.geometry("900x250") window.configure(background="white") #Text Label(window, text="WELCOME TO RICE QUALITY ANALYZER", bg="white", fg="black", font="none 11 bold").grid(row=0, column=0, sticky=W) # logo #PhotoImage.zoom(25,35) photologo = PhotoImage(file="logo3.GIF") Label(window, image=photologo).grid(row=0, column=1, sticky=E) #l.pack()
main(fichier,interface,var_label) bouton_afficher=Button(interface, command=Afficher, text="Afficher", bg="#e53737", activebackground="#ea7575", width="20", height="3", font=("bold",15),fg="#f1f1f1", relief="flat") bouton_afficher = bouton_afficher.pack() interface.update() def Afficher(): webbrowser.open("result_projet.html", new=0, autoraise=True) def Enregistrer(): sauvegarder = open("result_projet.html","r") fichier = tkinter.filedialog.asksaveasfile(mode='w', defaultextension=".html") fichier.write(sauvegarder.read()) interface = Tk() interface.title("Projet de M1") interface.geometry("450x450") menubar = Menu(interface) imgicon = PhotoImage(file=os.path.join('','dove.png')) interface.tk.call('wm','iconphoto',interface._w,imgicon) photo = PhotoImage(file="dove_3.png") canvas = Canvas(interface,width=100, height=100) canvas.create_image(0, 0, anchor=NW, image=photo) canvas.pack() """ p = PanedWindow(interface, orient=HORIZONTAL) p.pack(side=TOP, expand=N, fill=BOTH, pady=20, padx=2) p.add(canvas.pack())
#create unique filename timestr = time.strftime("%m%d%Y-%H%M%S") updated_filename = "updated_" + newpricecol + "_" + timestr + ".csv" not_updated_filename = "not_updated_" + newpricecol + "_" + timestr + ".csv" #convert pandas dataframe to .csv and save (keeps only 'productcode and product price') updated_csv = updated.to_csv(path_or_buf=updated_filename, columns=["productcode", newpricecol], index=False) not_updated_csv = not_updated.to_csv(path_or_buf=not_updated_filename, columns=["productcode", newpricecol], index=False) #create message for user window = Tk() window.wm_withdraw() #build message if int(matched) > 0: countmessage = "Success!\n" + matched + " listings matched\n" + unmatched + " listings unmatched\n" + "Remember to update adder prices for matched products. This program only updates indentical SKU matches and will not change option prices" else: countmessage = "The program was unable to find any matches. Email Michael at [email protected] with questions" #message at x:200,y:200 window.geometry( "1x1+200+200") #remember its .geometry("WidthxHeight(+or-)X(+or-)Y") messagebox.showinfo(title="Program Complete", message=countmessage, parent=window) print(countmessage)
#!/bin/env python import tkinter as Tk from tkinter import * about = Tk() about.title("About termux-desktop") about.geometry("320x200") text = Label(about, text=""" Termux-desktop-xfce is an active project with the aim of giving a unique look to termux x11 """) text.pack() mensaje = Label(about, text="Tank you for interest in termux-desktop-xfce!", fg="red") mensaje.pack() creador = Label(about, text=" - The Yisus Development Team", fg="green") creador.pack() about.mainloop()
import tkinter as Tk from tkinter import * import pyodbc as odbc from pyodbc import * golfers = Tk() golfers.title("Golfers") golfers.geometry('400x600') # Databases # Create a Database or Connect to one conn = odbc.connect('Driver={SQL Server};' 'Server=DESKTOP-SCL1250\SQLEXPRESS01;' 'Database=tgt;' 'Trusted_Connection=yes;') # Create Cursor c = conn.cursor() # # #Commit Changes c.commit() # Close Connection c.close() golfers.mainloop()
from tkinter import * from pygame import mixer from PIL import Image, ImageTk mixer.init() mixer.music.load('goodPlace.mp3') #serial read ser = serial.Serial(" COM11", 9600) s = ser.read() # In[2]: win = Tk() win.title('Mars Feng Shui detector') win.geometry('800x600') label = Label(win, text='風水 Feng Shui', bg="yellow") label.config(width=200) label.config(font=("Courier", 50)) label.pack() label = Label(win, text='開啟所要評分圖片並連接感測器') label.config(width=200) label.config(font=("Courier", 30)) label.pack() # In[3]: img = cv2.imread(tkinter.filedialog.askopenfilename(), 0) #img = ImageTk.PhotoImage(Image.open(tkinter.filedialog.askopenfilename()))
else: window.destroy() window.counter += 1 from tkinter import * from tkinter import ttk window = Tk() window.configure(background='grey') window.title('Virtual warehouse') window.counter = 0 w, h = window.winfo_screenwidth(), window.winfo_screenheight() window.geometry("%dx%d+0+0" % (w, h)) nb = ttk.Notebook(window, width=200, height=580) page1 = ttk.Frame(nb) nb.add(page1, text='Shortest Path' '\n' 'Start with (0,0)!') choose_loc = Listbox(page1) choose_loc.configure(selectmode=MULTIPLE, width=9, height=20) choose_loc.pack() btnGet = Button(page1,text="Get Selection",command=get_selection) btnGet.pack(side=TOP)
def intermediaire3D(): root = Tk() root.config(bg="#DCDCDC") if var_langue == "francais": root.title("Options 3D") else: root.title("3D options") root.geometry("350x800") root.resizable( width=False, height=False) # Redimensionnement de la fenêtre immobilisée. police_options3D = font.Font( root, size=12, weight='bold', family='Helvectica') # Mise en place du style police. label1 = Label(root, text="Sélection les numéros de boutons à afficher :", font=police_options3D) label1.config(bg="#DCDCDC") label1.pack() f3 = Frame(root) s3 = Scrollbar(f3) l3 = Listbox(f3, selectmode=MULTIPLE, exportselection=0, bg='#F9F9F8', font=police_options3D) # EXTENDED f5 = Frame(root) l5 = Listbox(f5, selectmode=MULTIPLE, exportselection=0, bg='#F9F9F8', font=police_options3D) # EXTENDED if var_langue == "francais": l3.insert(0, 'Déselectionner') else: l3.insert(0, 'Deselect') l3.itemconfig(0, bg='#ff6666') if var_langue == "francais": for i in range(1, 40): l3.insert(i, 'Marqueur ' + str(i)) else: for i in range(1, 40): l3.insert(i, 'Marker ' + str(i)) s3.config(command=l3.yview) l3.config(yscrollcommand=s3.set) l3.pack(side=LEFT, fill=Y) s3.pack(side=RIGHT, fill=Y) f3.pack() def clic3(evt): items = l3.curselection() if 0 in items: l3.selection_clear(0, 40) global leger leger.extend(l3.curselection()) return print( items) # On retourne l'élément (un string) sélectionné def clicd3(evt): print(evt.y) # recupere la coordonée selon y print(l3.nearest(evt.y)) # reecupere le bouton le plus proche print(evt) fr = l3.nearest(evt.y) # vou[fr][i][0] # s1 = [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] s2 = [] s1 = [] t = [] fig = plt.figure() ax1 = fig.add_subplot(211) ax2 = fig.add_subplot(212, sharex=ax1) for i in range(len(vou[fr]) - 11550): s1.append(vou[fr][i][0]) s2.append((vou[fr][i + 1][0] - vou[fr][i][0]) / 15) t.append(i) print('att') ax1.plot(t, s1) # ax2.plot(t, s2) del s1[i] ax2.plot(t, s2) # t=np.arange(59) multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1) pts = ginput(2) print(pts) x = math.floor(pts[0][0]) x1 = math.floor(pts[1][0]) y = str(s1[x]) v = str(s2[x]) y1 = str(s1[x1]) v1 = str(s2[x1]) ax1.text(0, 50, r'y(t)=' + y, fontsize=15, bbox={ 'facecolor': 'blue', 'alpha': 0.5, 'pad': 10 }) ax2.text(0, 13, r'v(y)=' + v, fontsize=15) ax1.annotate('y(t)=' + y, xy=(x, s1[x]), xytext=(x + 1, s1[x] + 5), arrowprops=dict(facecolor='black', shrink=0.05)) ax2.annotate('v(y)=' + v, xy=(x, s2[x]), xytext=(x + 1, s2[x] + 5), arrowprops=dict(facecolor='black', shrink=0.05)) ax1.text(0, 50, r'y(t)=' + y1, fontsize=15, bbox={ 'facecolor': 'blue', 'alpha': 0.5, 'pad': 10 }) ax2.text(0, 13, r'v(y)=' + v1, fontsize=15) ax1.annotate('y(t)=' + y1, xy=(x1, s1[x1]), xytext=(x1 + 1, s1[x1] + 5), arrowprops=dict(facecolor='black', shrink=0.05)) ax2.annotate('v(y)=' + v1, xy=(x1, s2[x1]), xytext=(x1 + 1, s2[x1] + 5), arrowprops=dict(facecolor='black', shrink=0.05)) plt.show() l3.bind( '<ButtonRelease-1>', clic3 ) ## on associe l'évènement "relachement du bouton gauche la souris" à la listbox l3.bind('<Double-Button-1>', clicd3) label2 = Label(root, text="Sélection du style :", font=police_options3D) label2.config(bg="#DCDCDC") label2.pack() f4 = Frame(root) s4 = Scrollbar(f4) l4 = Listbox(f4, selectmode=MULTIPLE, exportselection=0, bg='#F9F9F8', font=police_options3D) # EXTENDED if var_langue == "francais": l4.insert(0, 'Déselectionner') l4.itemconfig(0, bg='#ff6666') l4.insert(1, 'Traits') l4.insert(2, 'Points') l4.insert(3, 'Relier') l4.insert(4, 'Effacer') l4.insert(5, 'Historique') else: l4.insert(0, 'Deselect') l4.itemconfig(0, bg='#ff6666') l4.insert(1, 'Lines') l4.insert(2, 'Dots') l4.insert(3, 'Link') l4.insert(4, 'Erase') l4.insert(5, 'History') s4.config(command=l3.yview) l4.config(yscrollcommand=s4.set) l4.pack(side=LEFT, fill=Y) s4.pack(side=RIGHT, fill=Y) f4.pack() def clic4(evt): items = l4.curselection() if 0 in items: l4.selection_clear(0, 4) if 1 in items: l4.selection_clear(3) if 3 in items: l4.selection_clear(1) '''#animate(i)''' fonction3D(fenetreResultat, chemin, l4.curselection(), [], []) if (3 in items) == False: l4.selection_clear(4) if 4 in items: global lourd lourd = [] return print( items) ## On retourne l'élément (un string) sélectionné fonction3D(fenetreResultat, chemin, l4.curselection(), [], []) l4.bind( '<ButtonRelease-1>', clic4 ) ## on associe l'évènement "relachement du bouton gauche la souris" à la listbox label3 = Label(root, text="Points à afficher (tous par défaut):", font=police_options3D) label3.config(bg="#DCDCDC") label3.pack() s5 = Scrollbar(f5) if var_langue == "francais": l5.insert(0, 'Déselectionner') else: l5.insert(0, "Deselect") l5.itemconfig(0, bg='#ff6666') if var_langue == "francais": for i in range(1, 40): l5.insert(i, 'Marqueur ' + str(i)) else: for i in range(1, 40): l5.insert(i, 'Marker ' + str(i)) s5.config(command=l5.yview) l5.config(yscrollcommand=s5.set) l5.pack(side=LEFT, fill=Y) s5.pack(side=RIGHT, fill=Y) f5.pack() def clic5(evt): itemos = l5.curselection() if len(itemos) > 2: l5.selection_clear(itemos[0]) print(len(itemos)) if len(itemos) == 2: global lourd lourd.append(l5.curselection()) if 0 in itemos: l5.selection_clear(0, 40) return print( itemos) ## On retourne l'élément (un string) sélectionné l5.bind( '<ButtonRelease-1>', clic5 ) ## on associe l'évènement "relachement du bouton gauche la souris" à la listbox if var_langue == "anglais": label1["text"] = "Select the number of buttons to display :" label2["text"] = "Select the style :" label3["text"] = "Dots to display (all by default) :" root.mainloop()
showinfo('Exit', 'Welcome back on kofi!') #Initailisation de la fenêtre principale main = Tk() main.title("Kofi") main.configure(bg = "white") main.resizable(0,0) #main.attributes("-fullscreen", 2) #On récupère la largeur (ws) et la hauteur (hs) de la fenêtre ws = main.winfo_screenwidth() hs = main.winfo_screenheight() #calcul la position de la fenetre adaptée à l'écra, x = (ws/2) - (ws/2) y = (hs/2) - (hs/2) #applique la taille et la position main.geometry('%dx%d+%d+%d' % (ws, hs, 0, 0)) #intercepte l'evenement quit pour informer l'utilisateur, appel la fonction Exit main.protocol("WM_DELETE_WINDOW", Exit) # Fonction d'affichage de l'heure time1 = '' time2 = '' def hour(): global time1 # Heure actuelle du PC time2 = time.strftime('%H:%M:%S')
def quiz(): mat = Tk() global count, score score = 0 count = 0 mat.geometry("800x400") mat.title("English Quiz") mat.configure(background="yellow") def ask_question(): global score, count # get globals qq = get_questions("english.json") score_readout = Label(mat, text="Score: " + str(score) + "/" + str(count), font=(None, 15), fg="blue", bg="yellow") score_readout.pack(side="top", anchor="w") # retrive questions from json parcer with inputed json files eh1 = Label(mat, text="Question " + str(count + 1), font=(None, 15), fg="blue", bg="yellow") eh1.pack(side="top", anchor="e") spacing_label = Label(mat, text="", font=(None, 15), fg="blue", bg="yellow") spacing_label.pack() question_label = Label(mat, text=qq[4], font=(None, 10), fg="blue", bg="yellow", wraplength=750) question_label.pack(side="top", anchor="w") def correct(): global score, count mixer.init(22050, -8, 4, 65536) mixer.music.load('rr.ogg') mixer.music.play(0) score = score + 1 count = count + 1 unpack_all() if count < 10: ask_question() else: end_score = str(score) + " / " + str(10) messagebox.showinfo( "Score", "Your Score Was: %s" % score + " Out of 10") mat.destroy() def incorrect(): global count, score mixer.init(22050, -8, 4, 65536) mixer.music.load('ww.ogg') mixer.music.play(0) count = count + 1 unpack_all() if count < 10: ask_question() else: # end_score = str(score)+"/"+"10" mat.destroy() messagebox.showinfo( "Score", "Your Score Was: %s" % score + " Out of 10") mat.destroy() score = 0 count = 0 # end_score = 0 spacing_label2 = Label(mat, text="", bg='yellow') spacing_label2.pack() def unpack_all(): for mat_b in bttns: mat_b.pack_forget() score_readout.pack_forget() eh1.pack_forget() question_label.pack_forget() spacing_label.pack_forget() spacing_label2.pack_forget() mat_b1 = Button(mat, text=qq[0], command=correct, font=(None, 12), width=80, bg='gold', fg='blue') mat_b2 = Button(mat, text=qq[1], command=incorrect, font=(None, 12), width=80, bg='gold', fg='blue') mat_b3 = Button(mat, text=qq[2], command=incorrect, font=(None, 12), width=80, bg='gold', fg='blue') mat_b4 = Button(mat, text=qq[3], command=incorrect, font=(None, 12), width=80, bg='gold', fg='blue') bttns = [mat_b1, mat_b2, mat_b3, mat_b4] shuffle(bttns) for mat_ in bttns: mat_.pack(side="top", anchor="w") ask_question() mat.mainloop()
import tkinter as Tk from tkinter import * import pyodbc as odbc from pyodbc import * events = Tk() events.title("Events") events.geometry('400x600') # Databases # Create a Database or Connect to one conn = odbc.connect('Driver={SQL Server};' 'Server=DESKTOP-SCL1250\SQLEXPRESS01;' 'Database=tgt;' 'Trusted_Connection=yes;') # Create Cursor c = conn.cursor() # Create Functions # Create Text Boxes event_id = Entry(events, width=30) event_id.grid(row=1, column=1, padx=20) event_type = Entry(events, width=30) event_type.grid(row=2, column=1, padx=20) event_name = Entry(events, width=30) event_name.grid(row=3, column=1, padx=20) event_winner = Entry(events, width=30) event_winner.grid(row=4, column=1, padx=20)
#!/usr/bin/env python # coding: utf-8 # In[21]: import tkinter as Tk from tkinter import * import tkinter # In[54]: top = Tk() top.title("Data Science") top.geometry("1200x800+0+0") top.configure(background="powderblue") def func(): n = name.get() print(n) tkinter.Label(top, text="Today's Visitor", font=('times', 20, 'bold'), height='1', width='13').grid(row=0, column=0, sticky=W) tkinter.Label(top, text="0",