def show(self, title='image', temp='_temp_.ppm'): """Displays self in a pop-up window using Tkinter, and waits till the user either clicks on or closes the window. Saves the image as a temporary ppm file (specified by temp).""" if _tkinter._default_root: root = _tkinter.Toplevel() else: root = _tkinter.Tk() self.save_ppm(temp) image = _tkinter.PhotoImage(master=root, file=temp) root.title('%dx%d image' % (self.width, self.height)) label = _tkinter.Label(root, image=image) label.pack() label.bind('<Button>', lambda e: root.destroy()) root.mainloop() os.remove(temp)
import _tkinter as tk ventana = tk.Tk() """ print("dime tu estatura en metros y peso en kilos ") peso = 0 altura = 0.00 while peso <= 0 or peso >= 600: peso = int(input("Dime tu peso en kilos: ")) while altura <= 0 or altura >= 3: altura = float(input("Dime tu estatura en metro: ")) imc = round(peso / (altura ** 2), 1) if imc < 18.5: print("Delgadez o bajo peso o desnutrido") elif imc >= 18.5 and imc <= 24.9: print("Normal") elif imc > 24.9 and imc <= 29.9: print("Peso superior al normal") else: print("Obesidad") """
import _tkinter as tk tk.Tk()
import _tkinter as tk # note that module name has changed from Tkinter in Python 2 to tkinter in Python 3 top = tk.Tk() # Code to add widgets will go here... top.mainloop() #import tkinter import _tkinter #tkinter.test() #window = Tk() #window.title("This is my test") #window.mainloop()
self.container = tk.Frame(self) self.buttonframe.pack(side='top', fill='x', expand=False) self.container.pack(side='top', fill='both', expand=True) Pag1.place(in_=self.container, x=0, y=0, relwidth=1, relheight=1) Pag2.place(in_=self.container, x=0, y=0, relwidth=1, relheight=1) Pag3.place(in_=self.container, x=0, y=0, relwidth=1, relheight=1) Pag4.place(in_=self.container, x=0, y=0, relwidth=1, relheight=1) Pag3.show() def schermNieuweFiets(self): Pag1.lift() def schermFietsOphalen(self): Pag4.lift() def schermMainMenu(self): Pag3.lift() def schermFietsStallen(self): Pag2.lift() if __name__ == "__main__": root = tk.Tk() main = HoofdScherm() main.pack(side='top', fill='both', expand=True) root.geometry('640x640') root.mainloop()
__author__ = 'Derek' import _tkinter window = _tkinter.Tk() window.mainloop()