viernes, 13 de octubre de 2017

Interfaz basica de una calculadora en python



# s6_calculadora.py
from tkinter import *

win=Tk()
b0 = Button(win,text="0")
b1 = Button(win,text="1")
b2 = Button(win,text="2")
b3 = Button(win,text="3")
b4 = Button(win,text="4")
b5 = Button(win,text="5")
b6 = Button(win,text="6")
b7 = Button(win,text="7")
b8 = Button(win,text="8")
b9 = Button(win,text="9")
bmas = Button(win,text="+")
bmenos = Button(win,text="-")
bpor = Button(win,text="*")
bdiv = Button(win,text="/")
bpunto = Button(win,text=".")
bigual = Button(win,text="=")

b0.grid(row=3, column=0)
b1.grid(row=2, column=0)
b2.grid(row=2, column=1)
b3.grid(row=2, column=2)
b4.grid(row=1, column=0)
b5.grid(row=1, column=1)
b6.grid(row=1, column=2)
b7.grid(row=0, column=0)
b8.grid(row=0, column=1)
b9.grid(row=0, column=2)
bmas.grid(row=3, column=3)
bmenos.grid(row=2, column=3)
bpor.grid(row=1, column=3)
bdiv.grid(row=0, column=3)
bpunto.grid(row=3, column=1)
bigual.grid(row=3, column=2)

win.mainloop()

No hay comentarios:

Publicar un comentario