You've already forked Curso-lenguaje-python
Add library exercises
This commit is contained in:
32
python-ofensivo/08_librerias/08_tkinter_01_pack.py
Normal file
32
python-ofensivo/08_librerias/08_tkinter_01_pack.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Librería tkinter - pack
|
||||
|
||||
"""
|
||||
|
||||
import tkinter as tk
|
||||
|
||||
|
||||
def accion_de_boton():
|
||||
|
||||
print(f"\n[+] Se ha presionado el botón")
|
||||
|
||||
|
||||
root = tk.Tk()
|
||||
root.title("Mi primera aplicación gráfica")
|
||||
|
||||
label1 = tk.Label(root, text="Hola mundo!", bg="red", fg="white")
|
||||
label2 = tk.Label(root, text="Hola mundo!", bg="blue", fg="white")
|
||||
label3 = tk.Label(root, text="Hola mundo!", bg="green", fg="white")
|
||||
label1.pack(fill=tk.X)
|
||||
label2.pack(fill=tk.X)
|
||||
label3.pack(side=tk.LEFT, fill=tk.Y)
|
||||
|
||||
button1 = tk.Button(root, text="Accion",
|
||||
command=accion_de_boton, bg="grey", fg="white")
|
||||
button2 = tk.Button(root, text="Salir", command=root.quit,
|
||||
bg="white", fg="black")
|
||||
button1.pack()
|
||||
button2.pack(side=tk.BOTTOM, fill=tk.X)
|
||||
|
||||
root.mainloop()
|
||||
Reference in New Issue
Block a user