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 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 Exit(): if askyesno("Exit", "Do you really want to exit kofi :'( ?"): showwarning('Exit', "Exiting...see you soon") main.destroy() else: 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 = ''
plot_button['text'] = 'Exit' 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)
root = Toplevel() app = App(root) 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)
class WCUI: window = "" Sc_height = 0 Sc_width = 0 def __init__(self): self.window = Tk() self.window.title("Web Customizer") self.window.geometry('800x800') self.window.config(bg="white") self.window.overrideredirect(False) self.Sc_height = self.window.winfo_screenheight() // 2 self.Sc_width = self.window.winfo_screenwidth() // 2 self.window.geometry(f"{self.Sc_width}x{self.Sc_height}") print(self.Sc_height) self.nlpObject = Nlp() self.htmlObject = html_writer() def makeChanges(self, changes): if (len(changes) >= 3 and not (changes == None) and not (changes == "")): print(changes) self.nlpObject.proccessInput(changes) def resetpage(self): self.htmlObject.file_writer() def clearEntry(self, inputText): self.inputText.delete(0.0, 23.0) def mainmenu(self): myFont = font.Font(size=15) self.inputText = Text(self.window, height=self.Sc_height, width=self.Sc_width, bg="black", fg="white", insertbackground='white') self.inputText['font'] = myFont self.inputText.insert(0.0, 'Type changes need here ...') self.inputText.bind("<Button-1>", self.clearEntry) self.inputText.place(relx=0, rely=0) resetbutton = Button(self.window, text="Reset Webpage", width=400, bg="yellow", fg="black", command=lambda: self.resetpage()) resetbutton['font'] = myFont resetbutton.pack(side=BOTTOM) button = Button(self.window, text="Apply Changes", width=500, bg="blue", fg="white", command=lambda: self.makeChanges( self.inputText.get("1.0", "end-1c"))) button['font'] = myFont button.pack(side=BOTTOM) self.window.mainloop()
def getMsize(cls, root: tkinter): screenwidth = root.winfo_screenwidth() screenheight = root.winfo_screenheight() return Config.main_win_width, Config.main_win_height, ( screenwidth - Config.main_win_width) / 2, ( screenheight - Config.main_win_height) / 2