Skip to content

Instantly share code, notes, and snippets.

@nicanor-romerovenier
Created October 30, 2016 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicanor-romerovenier/a656341707acac048985111340246a05 to your computer and use it in GitHub Desktop.
Save nicanor-romerovenier/a656341707acac048985111340246a05 to your computer and use it in GitHub Desktop.
Programar Fácil - Tutorial de Python # 13
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tkinter
from tkinter import messagebox
def accion_de_mi_boton():
numero_1 = int(mi_entrada_1.get())
numero_2 = int(mi_entrada_2.get())
resultado = numero_1 * numero_2
mensaje_resultado = str(numero_1) + " x " + str(numero_2) + " = " + str(resultado)
messagebox.showinfo("Resultado", mensaje_resultado)
mi_ventana = tkinter.Tk()
mi_ventana.geometry("640x480")
mi_entrada_1 = tkinter.Entry()
mi_entrada_1.pack()
mi_entrada_2 = tkinter.Entry()
mi_entrada_2.pack()
mi_boton = tkinter.Button(text="Mi botón!", command=accion_de_mi_boton)
mi_boton.pack()
mi_ventana.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment