2024-01-23 21:21:18 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
"""
|
|
|
|
Librería tkinter - messagebox
|
|
|
|
|
2024-01-24 18:44:22 +01:00
|
|
|
Con dir(messagebox) podemos ver los métodos que tiene esta librería
|
|
|
|
|
2024-01-23 21:21:18 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
import tkinter as tk
|
|
|
|
from tkinter import messagebox as mb
|
|
|
|
|
|
|
|
|
|
|
|
def accion_boton():
|
|
|
|
mb.showinfo("Información",
|
|
|
|
"Este texto ha salido porque has pulsado el botón")
|
|
|
|
|
|
|
|
|
|
|
|
root = tk.Tk()
|
|
|
|
root.geometry("150x80")
|
|
|
|
root.title("Button() Widget & messagebox")
|
|
|
|
|
|
|
|
boton = tk.Button(root, text="ClickMe", command=accion_boton)
|
|
|
|
boton.pack(pady=10)
|
|
|
|
|
|
|
|
root.mainloop()
|