0% found this document useful (0 votes)
31 views3 pages

Calculadora Tkinter

Uploaded by

sanelpaisa01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

Calculadora Tkinter

Uploaded by

sanelpaisa01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 3

from tkinter import *

from tkinter import ttk

def sumar():

numero1 = int(txt1.get())

numero2 = int(txt2.get())

suma= numero1 + numero2

return total.set(suma)

def restar():

numero1 = int(txt1.get())

numero2 = int(txt2.get())

resta= numero1 - numero2

return total.set(resta)

def multiplicar():

numero1 = int(txt1.get())

numero2 = int(txt2.get())

multiplicacion= numero1 * numero2

return total.set(multiplicacion)

def dividir():

numero1 = int(txt1.get())

numero2 = int(txt2.get())

division= numero1 / numero2


return total.set(division)

windowp = Tk()

windowp.title("Calculadora Básica")

windowp.geometry("400x400")

windowp.resizable(False,False)

windowp.config(bg="wheat2")

label1 = Label(windowp, text= "Ingrese un número", bg="burlywood4", fg="white" )

label1.pack(padx=5, pady=3, ipadx=5, ipady=5,fill=X)

txt1 = Entry(windowp)

txt1.pack(padx=5, pady=3, ipadx=5, ipady=5, fill=X)

label2 = Label(windowp, text= "Ingrese un segundo número", bg="burlywood4", fg="white" )

label2.pack(padx=5, pady=3, ipadx=5, ipady=5,fill=X)

txt2 = Entry(windowp)

txt2.pack(padx=5, pady=3, ipadx=5, ipady=5, fill=X)

btnsumar = Button(windowp, text="Sumar", bg="cornsilk4", command=sumar)

btnsumar.pack(padx=5, pady=3, ipadx=5, ipady=5, fill=X)

btnrestar = Button(windowp, text="Restar", bg="cornsilk4", command=restar)


btnrestar.pack(padx=5, pady=3, ipadx=5, ipady=5, fill=X)

btnmultiplicar = Button(windowp, text="Multiplicar", bg="cornsilk4", command=multiplicar)

btnmultiplicar.pack(padx=5, pady=3, ipadx=5, ipady=5, fill=X)

btndividir = Button(windowp, text="Dividir", bg="cornsilk4", command=dividir)

btndividir.pack(padx=5, pady=3, ipadx=5, ipady=5, fill=X)

labelresult = Label(windowp, text= "Resultado de la suma", bg="burlywood4", fg="white" )

labelresult.pack(padx=5, pady=3, ipadx=5, ipady=5,fill=X)

total = StringVar()

txtresult = Entry(windowp, textvariable=total)

txtresult.pack(padx=5, pady=3, ipadx=5, ipady=5, fill=X)

windowp.mainloop()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy