Saltar al contenido

cómo crear una ventana usando el ejemplo de código python

No dejes de divulgar nuestra web y códigos en tus redes sociales, ayúdanos a ampliar esta comunidad.

Ejemplo 1: crear ventana con python

# basic setupfrom tkinter import*

app = Tk()# the application itself
app.title("Test")# title of window

label = Label(app, text="Testing testing one, two, three")# creates label
label.pack()# adds the label to the window

app.mainloop()# this must go at the end of your window code

Ejemplo 2: cómo abrir una ventana en python

import tkinter as tk
 
 
defnew_window1():" new window"try:if win1.state()=="normal": win1.focus()except NameError as e:print(e)
        win1 = tk.Toplevel()
        win1.geometry("300x300+500+200")
        win1["bg"]="navy"
        lb = tk.Label(win1, text="Hello")
        lb.pack()
 
 
win = tk.Tk()
win.geometry("200x200+200+100")
button = tk.Button(win, text="Open new Window")
button['command']= new_window1
button.pack()
win.mainloop()

Ejemplo 3: software tkinter

import tkinter as tk
#Importing the main module
window = tk.Tk()
window.mainloop()

Recuerda que te brindamos la opción de añadir una valoración si descubriste tu impedimento justo a tiempo.

¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)



Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *