1262 lines
53 KiB
Python
1262 lines
53 KiB
Python
|
|
#importacion de bibliotecas
|
||
|
|
|
||
|
|
from tkinter import *
|
||
|
|
import math
|
||
|
|
import tkinter as tk
|
||
|
|
|
||
|
|
#crear ventana
|
||
|
|
class MyVentana(Frame):
|
||
|
|
|
||
|
|
def __init__(self, master=None):
|
||
|
|
super().__init__(master)
|
||
|
|
|
||
|
|
self.master=master
|
||
|
|
self.master.title("Calculadora")
|
||
|
|
self.master.iconbitmap("calculadora.ico")
|
||
|
|
self.master.resizable(False,False)
|
||
|
|
self.iniciar()
|
||
|
|
|
||
|
|
#///////////////////////////////////////////////// Cimponentes //////////////////////////////////////////////////////////////////////////////////////////
|
||
|
|
|
||
|
|
#CREAR MODO BASICO"
|
||
|
|
|
||
|
|
def iniciar(self):
|
||
|
|
|
||
|
|
# clear contenedores
|
||
|
|
self.contenedormodNor=tk.Frame(master=self.master,width=300, height=390, bg='gray7')
|
||
|
|
|
||
|
|
# posisionar contenedores
|
||
|
|
self.contenedormodNor.pack(fill=tk.Y, side=tk.LEFT)
|
||
|
|
|
||
|
|
# crear elementos
|
||
|
|
|
||
|
|
#la caja de texto
|
||
|
|
self.pantallaNor=Text(self.contenedormodNor, state="disabled", width=10, height=3, background="gray9", foreground="DeepSkyBlue2", font=("Helvetica", 45))
|
||
|
|
#posisionar
|
||
|
|
self.pantallaNor.grid(row=0, column=0, columnspan=5, padx=5, pady=5)
|
||
|
|
|
||
|
|
#botones normal
|
||
|
|
|
||
|
|
self.bmenu=tk.Button(self.contenedormodNor, width=5, height=2, text="\u2630", bg='RoyalBlue4',font=("Helvetica", 15), command = lambda: self.craravans() ).grid(row=1, column=0, padx=0, pady=1)
|
||
|
|
self.bc=tk.Button(self.contenedormodNor, width=5, height=2, text="C", bg='RoyalBlue4', font=("Helvetica", 15), command = lambda: self.borrar() ).grid(row=1, column=4,padx=0, pady=1)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#fila 2
|
||
|
|
self.b1 = tk.Button(self.contenedormodNor, width=5, height=2, text="1", bg='DeepSkyBlue4', font=("Helvetica", 15), command = lambda: self.click_boton(1) ).grid(row=3,column=0,padx=0,pady=1)
|
||
|
|
self.b2 = tk.Button(self.contenedormodNor, width=5, height=2, text="2", bg='DeepSkyBlue4', font=("Helvetica", 15), command = lambda: self.click_boton(2) ).grid(row=3,column=1,padx=0,pady=1)
|
||
|
|
self.b3 = tk.Button(self.contenedormodNor, width=5, height=2, text="3", bg='DeepSkyBlue4', font=("Helvetica", 15), command = lambda: self.click_boton(3) ).grid(row=3, column=2,padx=0, pady=1)
|
||
|
|
self.bdiv = tk.Button(self.contenedormodNor, width=5, height=2, text="/", bg='DeepSkyBlue2', font=("Helvetica", 15), command = lambda: self.click_boton("/") ).grid(row=3, column=3,padx=0, pady=1)
|
||
|
|
self.bpot = tk.Button(self.contenedormodNor, width=5, height=2, text="\u221A", bg='DeepSkyBlue2', font=("Helvetica", 15), command = lambda: self.raiz() ).grid(row=3, column=4,padx=0, pady=1)
|
||
|
|
|
||
|
|
#fila 3
|
||
|
|
self.b4 = tk.Button(self.contenedormodNor, width=5, height=2, text="4", bg='DeepSkyBlue4', font=("Helvetica", 15), command = lambda: self.click_boton(4) ).grid(row=4,column=0,padx=0,pady=1)
|
||
|
|
self.b5 = tk.Button(self.contenedormodNor, width=5, height=2, text="5", bg='DeepSkyBlue4', font=("Helvetica", 15), command = lambda: self.click_boton(5) ).grid(row=4,column=1,padx=0,pady=1)
|
||
|
|
self.b6 = tk.Button(self.contenedormodNor, width=5, height=2, text="6", bg='DeepSkyBlue4', font=("Helvetica", 15), command = lambda: self.click_boton(6) ).grid(row=4, column=2,padx=0, pady=1)
|
||
|
|
self.bmul= tk.Button(self.contenedormodNor, width=5, height=2, text="*", bg='DeepSkyBlue2', font=("Helvetica", 15), command = lambda: self.click_boton("*") ).grid(row=4, column=3,padx=0, pady=1)
|
||
|
|
self.braiz = tk.Button(self.contenedormodNor, width=5, height=2, text="(", bg='DeepSkyBlue2', font=("Helvetica", 15), command = lambda: self.click_boton("(") ).grid(row=4, column=4,padx=0, pady=1)
|
||
|
|
|
||
|
|
|
||
|
|
#fila 4
|
||
|
|
self.b7 = tk.Button(self.contenedormodNor, width=5, height=2, text="7", bg='DeepSkyBlue4', font=("Helvetica", 15), command = lambda: self.click_boton(7) ).grid(row=5,column=0,padx=0,pady=1)
|
||
|
|
self.b8 = tk.Button(self.contenedormodNor, width=5, height=2, text="8", bg='DeepSkyBlue4', font=("Helvetica", 15), command = lambda: self.click_boton(8) ).grid(row=5,column=1,padx=0,pady=1)
|
||
|
|
self.b9 = tk.Button(self.contenedormodNor, width=5, height=2, text="9", bg='DeepSkyBlue4', font=("Helvetica", 15), command = lambda: self.click_boton(9) ).grid(row=5, column=2,padx=0, pady=1)
|
||
|
|
self.bres = tk.Button(self.contenedormodNor, width=5, height=2, text="-", bg='DeepSkyBlue2', font=("Helvetica", 15), command = lambda: self.click_boton("-") ).grid(row=5, column=3,padx=0, pady=1)
|
||
|
|
self.bsigno = tk.Button(self.contenedormodNor, width=5, height=2, text=")", bg='DeepSkyBlue2', font=("Helvetica", 15), command = lambda: self.click_boton(")") ).grid(row=5, column=4,padx=0, pady=1)
|
||
|
|
|
||
|
|
#fila 5
|
||
|
|
self.b0 = tk.Button(self.contenedormodNor, width=11, height=2, text="0", bg='DeepSkyBlue4', font=("Helvetica", 15), command = lambda: self.click_boton(0) ).grid(row=6,column=0,columnspan=2,padx=0,pady=1)
|
||
|
|
self.bpun = tk.Button(self.contenedormodNor, width=5, height=2, text=".", bg='DeepSkyBlue2', font=("Helvetica", 15), command = lambda: self.click_boton(".") ).grid(row=6, column=2,padx=0, pady=1)
|
||
|
|
self.bsum = tk.Button(self.contenedormodNor, width=5, height=2, text="+", bg='DeepSkyBlue2', font=("Helvetica", 15), command = lambda: self.click_boton("+") ).grid(row=6, column=3,padx=0, pady=1)
|
||
|
|
self.bigual = tk.Button(self.contenedormodNor, width=5, height=2, text="=", bg='DeepSkyBlue2', font=("Helvetica", 15), command = lambda: self.operacion() ).grid(row=6, column=4,padx=0, pady=1)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
# CREAR MODO AVANZADO
|
||
|
|
|
||
|
|
def craravans(self):
|
||
|
|
global x
|
||
|
|
x+=1
|
||
|
|
|
||
|
|
if(x==1):
|
||
|
|
|
||
|
|
#crear si si existe
|
||
|
|
self.contenedormodAbn = tk.Frame(master=self.master, width=280, height=390, bg='gray9')
|
||
|
|
self.contenedormodAbn.pack(fill=tk.Y, side=tk.LEFT)
|
||
|
|
|
||
|
|
# la caja de texto para el ID 70164163
|
||
|
|
|
||
|
|
self.idestudiante = Text(self.contenedormodAbn, state="disabled", width=13, height=1, background="gray9",foreground="SlateBlue2", font=("Helvetica", 12, "bold"))
|
||
|
|
|
||
|
|
# posisionar
|
||
|
|
self.idestudiante.grid(row=0, column=0, columnspan=5, padx=5, pady=5)
|
||
|
|
# Escrivir id
|
||
|
|
self.idestudiante.configure(state="normal")
|
||
|
|
self.idestudiante.insert("1.0", "RUCHIMISOFTH")
|
||
|
|
self.idestudiante.configure(state="disabled")
|
||
|
|
|
||
|
|
# fila 1 funciones
|
||
|
|
self.bed = tk.Button(self.contenedormodAbn, width=6, height=2, text="x^y", bg='DeepSkyBlue4', font=("Helvetica", 15),command=lambda: self.click_boton("**")).grid(row=1, column=0, padx=0, pady=1)
|
||
|
|
self.bpi = tk.Button(self.contenedormodAbn, width=6, height=2, text="Pi", bg='DeepSkyBlue4',font=("Helvetica", 15), command=lambda: self.pisi()).grid(row=1, column=1, padx=0,pady=1)
|
||
|
|
self.bsin = tk.Button(self.contenedormodAbn, width=6, height=2, text="sin", bg='DeepSkyBlue4',font=("Helvetica", 15), command=lambda: self.seno()).grid(row=1, column=2, padx=0,pady=1)
|
||
|
|
self.btan = tk.Button(self.contenedormodAbn, width=6, height=2, text="tan", bg='DeepSkyBlue4',font=("Helvetica", 15), command=lambda: self.tange()).grid(row=1, column=3, padx=0,pady=1)
|
||
|
|
self.bne = tk.Button(self.contenedormodAbn, width=6, height=2, text="n!", bg='DeepSkyBlue4',font=("Helvetica", 15), command=lambda: self.facto()).grid(row=1, column=4, padx=0,pady=1)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
# fila 2 funciones
|
||
|
|
self.bex=tk.Button(self.contenedormodAbn, width=6, height=2, text="n_n", bg='RoyalBlue4', font=("Helvetica", 15)).grid(row=2, column=1, padx=0, pady=1)
|
||
|
|
self.bohis = tk.Button(self.contenedormodAbn, width=6, height=2, text="BH", bg='RoyalBlue4',font=("Helvetica", 15), command=lambda: self.boristo()).grid(row=2, column=2,padx=0, pady=1)
|
||
|
|
self.bfrac = tk.Button(self.contenedormodAbn, width=6, height=2, text="Frac", bg='RoyalBlue4',font=("Helvetica", 15), command=lambda: self.desi()).grid(row=2, column=3, padx=0,pady=1)
|
||
|
|
|
||
|
|
# la caja de texto para el historial
|
||
|
|
self.historial = Text(self.contenedormodAbn, state="disabled", width=30, height=10, background="gray9",foreground="DeepSkyBlue2", font=("Helvetica", 15,"bold"))
|
||
|
|
# posisionar
|
||
|
|
self.historial.grid(row=3, column=0, columnspan=5, padx=5, pady=5)
|
||
|
|
|
||
|
|
# fila1Memoria
|
||
|
|
self.bmc1 = tk.Button(self.contenedormodAbn, width=6, height=1, text="MC", bg='RoyalBlue4',font=("Helvetica", 15), command=lambda: self.memoriC()).grid(row=4, column=0, padx=1, pady=4),
|
||
|
|
self.bmr1 = tk.Button(self.contenedormodAbn, width=6, height=1, text="MR", bg='DeepSkyBlue4',font=("Helvetica", 15), command=lambda: self.memoriR()).grid(row=4, column=1, padx=1, pady=4)
|
||
|
|
self.bms1 = tk.Button(self.contenedormodAbn, width=6, height=1, text="MS", bg='RoyalBlue4',font=("Helvetica", 15),command=lambda: self.memoriS()).grid(row=4, column=2, padx=1, pady=4)
|
||
|
|
self.bma1 = tk.Button(self.contenedormodAbn, width=6, height=1, text="M+", bg='DeepSkyBlue4',font=("Helvetica", 15), command=lambda: self.memorimas()).grid(row=4, column=3, padx=1, pady=4)
|
||
|
|
self.bmm1 = tk.Button(self.contenedormodAbn, width=6, height=1, text="M-", bg='DeepSkyBlue2', font=("Helvetica", 15), command=lambda: self.memorires()).grid(row=4, column=4, padx=1, pady=4)
|
||
|
|
|
||
|
|
# fila 2
|
||
|
|
self.bmc = tk.Button(self.contenedormodAbn, width=6, height=1, text="MC", bg='RoyalBlue4',font=("Helvetica", 15), command=lambda: self.memoriC2()).grid(row=5, column=0,padx=0, pady=1)
|
||
|
|
self.bmr = tk.Button(self.contenedormodAbn, width=6, height=1, text="MR", bg='DeepSkyBlue4', font=("Helvetica", 15), command=lambda: self.memoriR2()).grid(row=5, column=1, padx=0, pady=1)
|
||
|
|
self.bms = tk.Button(self.contenedormodAbn, width=6, height=1, text="MS", bg='RoyalBlue4',font=("Helvetica", 15), command=lambda:self.memoriS2()).grid(row=5, column=2, padx=0, pady=1)
|
||
|
|
self.bma = tk.Button(self.contenedormodAbn, width=6, height=1, text="M+", bg='DeepSkyBlue4',font=("Helvetica", 15), command=lambda: self.memorimas2()).grid(row=5, column=3,padx=0, pady=1)
|
||
|
|
self.bme = tk.Button(self.contenedormodAbn, width=6, height=1, text="M-", bg='DeepSkyBlue2',font=("Helvetica", 15), command=lambda: self.memorires2()).grid(row=5, column=4,padx=0, pady=1)
|
||
|
|
|
||
|
|
elif(x==2 or x>2):
|
||
|
|
|
||
|
|
#destruir si
|
||
|
|
x=0
|
||
|
|
self.contenedormodAbn.destroy()
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#/////////////////////////////////////////////////// FUNCIONES BAsicas ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#Escrivir en pantalla
|
||
|
|
|
||
|
|
def click_boton(self,valor):
|
||
|
|
|
||
|
|
global i,op
|
||
|
|
|
||
|
|
if(op==0):
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.insert(i, valor)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
i += 1.0
|
||
|
|
else:
|
||
|
|
i = 1.0
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete(i, END)
|
||
|
|
self.pantallaNor.insert(i, valor)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
i += 1.0
|
||
|
|
op = 0
|
||
|
|
return
|
||
|
|
|
||
|
|
# borrar
|
||
|
|
|
||
|
|
def borrar(self):
|
||
|
|
global i,op
|
||
|
|
i = 1.0
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete(i, END)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
op=0
|
||
|
|
return
|
||
|
|
|
||
|
|
#borrar historial
|
||
|
|
|
||
|
|
def boristo(self):
|
||
|
|
global i,op
|
||
|
|
|
||
|
|
i = 1.0
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete(i,END)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.delete(i,END)
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
op=0
|
||
|
|
return
|
||
|
|
|
||
|
|
|
||
|
|
def operacion(self):
|
||
|
|
|
||
|
|
global i, resultado,ecuasion,op,x
|
||
|
|
|
||
|
|
try:
|
||
|
|
ecuasion=self.pantallaNor.get(1.0, END+"-1c")
|
||
|
|
resultado=eval(ecuasion)
|
||
|
|
|
||
|
|
|
||
|
|
except ZeroDivisionError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(/0)")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR(/0)")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", ecuasion)
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", ecuasion)
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxWarning:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(Syntax) ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", ecuasion)
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except TypeError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", ecuasion)
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
else:
|
||
|
|
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", resultado)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", resultado)
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "=")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", ecuasion)
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
return
|
||
|
|
|
||
|
|
#/////////////////////////////////////////////////////////////////FUNCIONES AVANSADAS//////////////////////////////////////////////////////////////////
|
||
|
|
|
||
|
|
def raiz(self):
|
||
|
|
|
||
|
|
global i, resultado, ecuasion, op, x
|
||
|
|
try:
|
||
|
|
ecuasion = float(self.pantallaNor.get(1.0, END + "-1c"))
|
||
|
|
resultado =math.sqrt(ecuasion)
|
||
|
|
|
||
|
|
except ValueError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "Error")
|
||
|
|
self.historial.insert("1.0", "\u221A")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
else:
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.insert("1.0", resultado)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", resultado)
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "=")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", ecuasion)
|
||
|
|
self.historial.insert("1.0", "\u221A")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
return
|
||
|
|
|
||
|
|
def pisi(self):
|
||
|
|
|
||
|
|
global i, op, x,pi
|
||
|
|
|
||
|
|
try:
|
||
|
|
pi=math.pi
|
||
|
|
|
||
|
|
except ValueError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "Error")
|
||
|
|
self.historial.insert("1.0", "Pi")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
else:
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0",pi)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", pi)
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "=")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "Pi")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
def seno(self):
|
||
|
|
|
||
|
|
global i, resultado, ecuasion, op, x,ecuasionw
|
||
|
|
|
||
|
|
try:
|
||
|
|
ecuasionw= float(self.pantallaNor.get(1.0, END + "-1c"))
|
||
|
|
ecuasion=math.radians(ecuasionw)
|
||
|
|
resultado = math.sin(ecuasion)
|
||
|
|
|
||
|
|
except ValueError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "Error")
|
||
|
|
self.historial.insert("1.0", "Sin")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
else:
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", resultado)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", resultado)
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "=")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", ecuasionw)
|
||
|
|
self.historial.insert("1.0", "Sin")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
def tange(self):
|
||
|
|
|
||
|
|
global i, resultado, ecuasion, op, x,ecuasionw
|
||
|
|
|
||
|
|
try:
|
||
|
|
ecuasionw = float(self.pantallaNor.get(1.0, END + "-1c"))
|
||
|
|
ecuasion = math.radians(ecuasionw)
|
||
|
|
resultado = math.tan(ecuasion)
|
||
|
|
|
||
|
|
except ValueError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "Error")
|
||
|
|
self.historial.insert("1.0", "Tan")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
else:
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", resultado)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", resultado)
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "=")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", ecuasionw)
|
||
|
|
self.historial.insert("1.0", "Tan")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
def facto(self):
|
||
|
|
|
||
|
|
global i, resultado, op, x, ecuasionw
|
||
|
|
|
||
|
|
try:
|
||
|
|
ecuasionw = int(self.pantallaNor.get(1.0, END + "-1c"))
|
||
|
|
|
||
|
|
if(ecuasionw>100):
|
||
|
|
|
||
|
|
resultado =0
|
||
|
|
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(Numero grande)")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR de Memoria(Numero grande) ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "Error")
|
||
|
|
self.historial.insert("1.0", "Fac")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
else:
|
||
|
|
resultado = math.factorial(ecuasionw)
|
||
|
|
|
||
|
|
except ValueError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "Error")
|
||
|
|
self.historial.insert("1.0", "Fac")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
else:
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", resultado)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", resultado)
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "=")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", ecuasionw)
|
||
|
|
self.historial.insert("1.0", "Fac")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
return
|
||
|
|
|
||
|
|
def desi(self):
|
||
|
|
|
||
|
|
global i, resultado, op, x, ecuasionw,rue,rde,im
|
||
|
|
|
||
|
|
try:
|
||
|
|
|
||
|
|
ecuasionw = float(self.pantallaNor.get(1.0, END + "-1c"))
|
||
|
|
rue,rde=math.modf(ecuasionw)
|
||
|
|
im=rue
|
||
|
|
|
||
|
|
except ValueError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR(Syntax)")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "Error")
|
||
|
|
self.historial.insert("1.0", "Frac")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
else:
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", resultado)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", im)
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "=")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", ecuasionw)
|
||
|
|
self.historial.insert("1.0", "Fac")
|
||
|
|
self.historial.insert("1.0", "____________")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
return
|
||
|
|
#/////////////////////////////////////////////////////////////Funciones de memoria ///////////////////////////////////////////////////////////////////////
|
||
|
|
|
||
|
|
#Memoria 1
|
||
|
|
|
||
|
|
def memoriS(self):
|
||
|
|
|
||
|
|
global i, resultadom1, ecuasionm1, op, x, memoria1
|
||
|
|
|
||
|
|
try:
|
||
|
|
ecuasionm1 = self.pantallaNor.get(1.0, END + "-1c")
|
||
|
|
resultadom1 = eval(ecuasionm1)
|
||
|
|
|
||
|
|
|
||
|
|
except ZeroDivisionError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Guardado")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Guardado")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxWarning:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Guardado")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except TypeError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Guardado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
else:
|
||
|
|
memoria1=resultadom1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "GUARDADO ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "GUARDADO M1 ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
return
|
||
|
|
|
||
|
|
def memoriR(self):
|
||
|
|
|
||
|
|
global i, op, x, memoria1
|
||
|
|
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", memoria1)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0",memoria1)
|
||
|
|
self.historial.insert("1.0", " M1:")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
return
|
||
|
|
|
||
|
|
def memoriC(self):
|
||
|
|
|
||
|
|
global i, op, x, memoria1
|
||
|
|
|
||
|
|
memoria1=0.0
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", memoria1)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", " Basio ")
|
||
|
|
self.historial.insert("1.0", " M1:")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
return
|
||
|
|
|
||
|
|
def memorimas(self):
|
||
|
|
|
||
|
|
global i, resultadom1, ecuasionm1, op, x, memoria1,mesu
|
||
|
|
|
||
|
|
try:
|
||
|
|
ecuasionm1 = self.pantallaNor.get(1.0, END + "-1c")
|
||
|
|
mesu=eval(ecuasionm1)
|
||
|
|
resultadom1=memoria1+mesu
|
||
|
|
|
||
|
|
|
||
|
|
except ZeroDivisionError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Sumado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Sumado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxWarning:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Sumado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except TypeError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Sumado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
else:
|
||
|
|
memoria1=resultadom1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "GUARDADO ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "_M1 ")
|
||
|
|
self.historial.insert("1.0", mesu)
|
||
|
|
self.historial.insert("1.0", "SUMADO:")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
return
|
||
|
|
|
||
|
|
|
||
|
|
def memorires(self):
|
||
|
|
|
||
|
|
global i, resultadom1, ecuasionm1, op, x, memoria1,mesu
|
||
|
|
|
||
|
|
try:
|
||
|
|
ecuasionm1 = self.pantallaNor.get(1.0, END + "-1c")
|
||
|
|
mesu=eval(ecuasionm1)
|
||
|
|
resultadom1=memoria1-mesu
|
||
|
|
|
||
|
|
|
||
|
|
except ZeroDivisionError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Restado")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Restado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxWarning:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M1 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Restado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except TypeError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M1 No Restado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
else:
|
||
|
|
memoria1=resultadom1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "GUARDADO ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "_M1 ")
|
||
|
|
self.historial.insert("1.0", mesu)
|
||
|
|
self.historial.insert("1.0", "Restado:")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
return
|
||
|
|
|
||
|
|
#memoria 2
|
||
|
|
|
||
|
|
def memoriS2(self):
|
||
|
|
|
||
|
|
global i, resultadom1, ecuasionm1, op, x, memoria2
|
||
|
|
|
||
|
|
try:
|
||
|
|
ecuasionm1 = self.pantallaNor.get(1.0, END + "-1c")
|
||
|
|
resultadom1 = eval(ecuasionm1)
|
||
|
|
|
||
|
|
|
||
|
|
except ZeroDivisionError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Guardado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Guardado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxWarning:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Guardado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except TypeError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Guardado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
else:
|
||
|
|
memoria2=resultadom1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "GUARDADO ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "GUARDADO M2 ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
return
|
||
|
|
|
||
|
|
def memoriR2(self):
|
||
|
|
|
||
|
|
global i, op, x, memoria2
|
||
|
|
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", memoria2)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0",memoria2)
|
||
|
|
self.historial.insert("1.0", " M2:")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
return
|
||
|
|
|
||
|
|
def memoriC2(self):
|
||
|
|
|
||
|
|
global i, op, x, memoria2
|
||
|
|
|
||
|
|
memoria2=0.0
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", memoria2)
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", " Basio ")
|
||
|
|
self.historial.insert("1.0", " M2:")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
return
|
||
|
|
|
||
|
|
def memorimas2(self):
|
||
|
|
|
||
|
|
global i, resultadom1, ecuasionm1, op, x, memoria2,mesu
|
||
|
|
|
||
|
|
try:
|
||
|
|
ecuasionm1 = self.pantallaNor.get(1.0, END + "-1c")
|
||
|
|
mesu=eval(ecuasionm1)
|
||
|
|
resultadom1=memoria2+mesu
|
||
|
|
|
||
|
|
|
||
|
|
except ZeroDivisionError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Sumado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Sumado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxWarning:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Sumado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except TypeError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Sumado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
else:
|
||
|
|
memoria2=resultadom1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "GUARDADO ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "_M2 ")
|
||
|
|
self.historial.insert("1.0", mesu)
|
||
|
|
self.historial.insert("1.0", "SUMADO:")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
return
|
||
|
|
|
||
|
|
|
||
|
|
def memorires2(self):
|
||
|
|
|
||
|
|
global i, resultadom1, ecuasionm1, op, x, memoria2,mesu
|
||
|
|
|
||
|
|
try:
|
||
|
|
ecuasionm1 = self.pantallaNor.get(1.0, END + "-1c")
|
||
|
|
mesu=eval(ecuasionm1)
|
||
|
|
resultadom1=memoria2-mesu
|
||
|
|
|
||
|
|
|
||
|
|
except ZeroDivisionError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Restado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Restado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except SyntaxWarning:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Restado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
except TypeError:
|
||
|
|
op += 1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "ERROR M2 ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "ERROR M2 No Restado ")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
else:
|
||
|
|
memoria2=resultadom1
|
||
|
|
self.pantallaNor.configure(state="normal")
|
||
|
|
self.pantallaNor.delete("1.0", END)
|
||
|
|
self.pantallaNor.insert("1.0", "GUARDADO ")
|
||
|
|
self.pantallaNor.configure(state="disabled")
|
||
|
|
|
||
|
|
op += 1
|
||
|
|
|
||
|
|
if (x > 0):
|
||
|
|
self.historial.configure(state="normal")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.insert("1.0", "_M2 ")
|
||
|
|
self.historial.insert("1.0", mesu)
|
||
|
|
self.historial.insert("1.0", "Restado:")
|
||
|
|
self.historial.insert("1.0", "\n")
|
||
|
|
self.historial.configure(state="disabled")
|
||
|
|
|
||
|
|
return
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#contadores y variavles
|
||
|
|
|
||
|
|
i=1.0#
|
||
|
|
x=0
|
||
|
|
op=0
|
||
|
|
|
||
|
|
pi=0.0
|
||
|
|
rue=0.0
|
||
|
|
rde=0.0
|
||
|
|
im=0.0
|
||
|
|
|
||
|
|
memoria1=0.0
|
||
|
|
memoria2=0.0
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
ecuasionw=0.0
|
||
|
|
resultado=""
|
||
|
|
ecuasion=""
|
||
|
|
|
||
|
|
resultadom1=""
|
||
|
|
ecuasionm1=""
|
||
|
|
re=""
|
||
|
|
|
||
|
|
#ventana
|
||
|
|
vent=Tk()
|
||
|
|
app=MyVentana(vent)
|
||
|
|
app.mainloop()
|