Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Tkinter Calculator with full numpad support, hamfisted by your humble and gracious overlord, REED. 3/6/2018
- Each button press from the user is stored in a list and calculated only when the equals button has been hit. Due to some quirks the design,
- the percentage and square root operators can not be used at the same as normal operators handled by the eval() function. Exponents are also supported but not listed as a button in the GUI.
- GUI was created using PAGE version 4.9, in conjunction with Tcl version 8.6
- TODO:
- Add PlusMinus, as the buttom right most button is useless as of this moment
- """
- import sys
- import math
- try:
- from Tkinter import *
- except ImportError:
- from tkinter import *
- try:
- import ttk
- py3 = 0
- except ImportError:
- import tkinter.ttk as ttk
- py3 = 1
- def vp_start_gui():
- '''Starting point when module is the main routine.'''
- global val, w, root
- root = Tk()
- top = Calcul8r (root)
- root.mainloop()
- w = None
- def create_Calcul8r(root, *args, **kwargs):
- '''Starting point when module is imported by another program.'''
- global w, w_win, rt
- rt = root
- w = Toplevel (root)
- top = Calcul8r (w)
- return (w, top)
- def destroy_Calcul8r():
- global w
- w.destroy()
- w = None
- class Calcul8r:
- def __init__(self, top=None):
- FinEq = [] #stores button presses and the sum
- go = [] #stores a value that is checked by buttons 0-9 to see if the sum is displayed onscreen
- calc = [] #checks if an operator button has been pressed
- def UpdateScreen(equation):
- TooBig = False
- value = equation
- if len(equation) == 20:
- del FinEq[:]
- TooBig = True
- if len(equation) > 1:
- value = "".join(equation) #turns the list of values into a string
- if not TooBig:
- self.EquationWindow.configure(text=value) #pushes new values to the screen
- else:
- self.EquationWindow.configure(text="INTEGER OVERFLOW")
- self.EquationWindow = ttk.Label(top, anchor=E)
- self.EquationWindow.place(relx=0.03, rely=0.04, height=109, width=298)
- self.EquationWindow.configure(background="#c9c9c9")
- self.EquationWindow.configure(foreground="#000000")
- self.EquationWindow.configure(font=("Terminal",20))
- self.EquationWindow.configure(relief=GROOVE)
- self.EquationWindow.configure(anchor=CENTER)
- self.EquationWindow.configure(justify=CENTER)
- self.EquationWindow.configure(width=298)
- self.EquationWindow.configure(text="", anchor=E)
- def Equals(event=None): #This equals function is horribly messy, but it works as intended.
- TheSum = FinEq
- TheSum = "".join(FinEq) #eval() only accepts strings, so we convert the list to a string before passing it through
- try: #percentage and square root aren't supported by eval(), so if the user enters that and it fails, it passes it to the nonstandard functions below
- FinalSum = eval(TheSum)
- if FinalSum == 80085 or FinalSum == 8008135: #easter egg
- FinalSum = ["BOOBS! (.Y.)"]
- go.append("GO")
- UpdateScreen(FinalSum)
- del FinEq[:]
- UpdateScreen(str(FinalSum))
- FinEq.append(str(FinalSum))
- go.append("GO")
- except(ValueError, IOError, SyntaxError, NameError) as err: #this code is a mess, but hey! it works
- try:
- passed = False #for seeing if the if statements below have ran
- if FinEq[0] == "√":
- val = ''.join(FinEq)
- nval = val.split("√")
- Final_SQRT = math.sqrt(int(nval[1]))
- del FinEq[:]
- FinEq.append(str(Final_SQRT))
- UpdateScreen(str(Final_SQRT))
- go.append("GO")
- passed = True
- val = ''.join(FinEq)
- firstnum, operator,secondnum = val.partition("p%") #partions the value up into three different variables with the partion string in the middle. i.e., operator = p%
- if operator == "p%": #checks to see if the operator symbol is present in the variable expected
- val = ''.join(FinEq)
- nval = val.split("p%")
- Final_Percent = float(nval[0]) / 100 * float(nval[1])
- del FinEq[:]
- FinEq.append(str(Final_Percent))
- UpdateScreen(str(Final_Percent))
- passed = True
- go.append("GO")
- if passed == False: #if no if statement has passed above, it's clearly not valid input
- del FinEq[:]
- FinalSum = ["INVALID_EQUATION"]
- UpdateScreen(FinalSum)
- except(ValueError, IOError, SyntaxError, NameError) as err:
- del FinEq[:]
- FinalSum = ["INVALID_EQUATION"]
- UpdateScreen(FinalSum)
- def Button0(event=None):
- if "GO" in go:
- del go[:]
- del FinEq[:]
- if "CA" in calc:
- del go[:]
- del calc[:]
- FinEq.append("0")
- UpdateScreen(FinEq)
- def Button1(event=None):
- if "GO" in go:
- del go[:]
- del FinEq[:]
- if "CA" in calc:
- del go[:]
- del calc[:]
- FinEq.append("1")
- UpdateScreen(FinEq)
- def Button2(event=None):
- if "GO" in go:
- del go[:]
- del FinEq[:]
- if "CA" in calc:
- del go[:]
- del calc[:]
- FinEq.append("2")
- UpdateScreen(FinEq)
- def Button3(event=None):
- if "GO" in go:
- del go[:]
- del FinEq[:]
- if "CA" in calc:
- del go[:]
- del calc[:]
- FinEq.append("3")
- UpdateScreen(FinEq)
- def Button4(event=None):
- if "GO" in go:
- del go[:]
- del FinEq[:]
- if "CA" in calc:
- del go[:]
- del calc[:]
- FinEq.append("4")
- UpdateScreen(FinEq)
- def Button5(event=None):
- if "GO" in go:
- del go[:]
- del FinEq[:]
- FinEq.append("5")
- UpdateScreen(FinEq)
- def Button6(event=None):
- if "GO" in go:
- del go[:]
- del FinEq[:]
- if "CA" in calc:
- del go[:]
- del calc[:]
- FinEq.append("6")
- UpdateScreen(FinEq)
- def Button7(event=None):
- if "GO" in go:
- del go[:]
- del FinEq[:]
- if "CA" in calc:
- del go[:]
- del calc[:]
- FinEq.append("7")
- UpdateScreen(FinEq)
- def Button8(event=None):
- if "GO" in go:
- del go[:]
- del FinEq[:]
- if "CA" in calc:
- del go[:]
- del calc[:]
- FinEq.append("8")
- UpdateScreen(FinEq)
- def Button9(event=None):
- if "GO" in go:
- del go[:]
- del FinEq[:]
- if "CA" in calc:
- del go[:]
- del calc[:]
- FinEq.append("9")
- UpdateScreen(FinEq)
- def Decimal(event=None):
- del go[:]
- calc.append("CA")
- FinEq.append(".")
- UpdateScreen(FinEq)
- def Add(event=None):
- del go[:]
- calc.append("CA")
- FinEq.append("+")
- UpdateScreen(FinEq)
- def Subtract(event=None):
- del go[:]
- calc.append("CA")
- FinEq.append("-")
- UpdateScreen(FinEq)
- def Multiply(event=None):
- del go[:]
- calc.append("CA")
- FinEq.append("*")
- UpdateScreen(FinEq)
- def Divide(event=None):
- del go[:]
- calc.append("CA")
- FinEq.append("/")
- UpdateScreen(FinEq)
- def FloorDivide(event=None):
- del go[:]
- calc.append("CA")
- FinEq.append("//")
- UpdateScreen(FinEq)
- def Modulo(event=None):
- del go[:]
- calc.append("CA")
- FinEq.append("%")
- UpdateScreen(FinEq)
- def Percentage(event=None):
- del go[:]
- calc.append("CA")
- FinEq.append("p%")
- UpdateScreen(FinEq)
- def SquareRoot(event=None):
- del go[:]
- calc.append("CA")
- FinEq.append("√")
- UpdateScreen(FinEq)
- def PlusMinus(event=None):
- del go[:]
- calc.append("CA")
- pass
- def ClearAll(event=None):
- del FinEq[:]
- UpdateScreen(FinEq)
- def Exponent(event=None):
- del go[:]
- calc.append("CA")
- FinEq.append("^")
- UpdateScreen(FinEq)
- def BackSpace(event=None):
- try:
- del FinEq[-1]
- UpdateScreen(FinEq)
- except(IndexError) as err: #excepts IndexError and passes it, as hitting multiple backspaces when there are no values present in FinEq[] will cause one
- pass
- '''This class configures and populates the toplevel window.
- top is the toplevel containing window.'''
- _bgcolor = '#d9d9d9' # X11 color: 'gray85'
- _fgcolor = '#000000' # X11 color: 'black'
- _compcolor = '#d9d9d9' # X11 color: 'gray85'
- _ana1color = '#d9d9d9' # X11 color: 'gray85'
- _ana2color = '#d9d9d9' # X11 color: 'gray85'
- self.style = ttk.Style()
- if sys.platform == "win32":
- self.style.theme_use('winnative')
- self.style.configure('.',background=_bgcolor)
- self.style.configure('.',foreground=_fgcolor)
- self.style.configure('.',font="TkDefaultFont")
- self.style.map('.',background=
- [('selected', _compcolor), ('active',_ana2color)])
- top.geometry("320x382+792+210")
- top.title("Calcul8r")
- top.configure(background="#d9d9d9")
- #Tkinter doesnt differentiate between numpad arrows and regular arrows,
- #so there is a slight quirk. the arrowpad can enter 6,2,4,8
- top.bind("<Insert>", Button0)
- top.bind("0", Button0)
- top.bind("<End>", Button1)
- top.bind("1", Button1)
- top.bind("<Down>", Button2)
- top.bind("2", Button2)
- top.bind("<Next>", Button3)
- top.bind("3", Button3)
- top.bind("<Left>", Button4)
- top.bind("4", Button4)
- top.bind("<Clear>", Button5)
- top.bind("5", Button5)
- top.bind("<Right>", Button6)
- top.bind("6", Button6)
- top.bind("<Home>", Button7)
- top.bind("7", Button7)
- top.bind("<Up>", Button8)
- top.bind("8", Button8)
- top.bind("<Prior>", Button9)
- top.bind("9", Button9)
- top.bind("<minus>", Subtract)
- top.bind("<plus>", Add)
- top.bind("<equal>", Add)
- top.bind("<Return>", Equals)
- top.bind("<Delete>", Decimal)
- top.bind("<period>", Decimal)
- top.bind("<asterisk>", Multiply)
- top.bind("<slash>", Divide)
- top.bind("<percent>", Percentage)
- top.bind("<asciicircum>", Exponent)
- top.bind("<Num_Lock>", BackSpace)
- top.bind("<BackSpace>", BackSpace)
- self.Bu0 = Button(top, command= Button0)
- self.Bu0.place(relx=0.25, rely=0.9, height=34, width=78)
- self.Bu0.configure(activebackground="#d9d9d9")
- self.Bu0.configure(activeforeground="#000000")
- self.Bu0.configure(background="#d9d9d9")
- self.Bu0.configure(disabledforeground="#a3a3a3")
- self.Bu0.configure(font="Font10")
- self.Bu0.configure(foreground="#000000")
- self.Bu0.configure(highlightbackground="#d9d9d9")
- self.Bu0.configure(highlightcolor="black")
- self.Bu0.configure(pady="0")
- self.Bu0.configure(text='''0''')
- self.Bu1 = Button(top, command = Button1)
- self.Bu1.place(relx=0.0, rely=0.79, height=34, width=78)
- self.Bu1.configure(activebackground="#d9d9d9")
- self.Bu1.configure(activeforeground="#000000")
- self.Bu1.configure(background="#d9d9d9")
- self.Bu1.configure(disabledforeground="#a3a3a3")
- self.Bu1.configure(font="Font10")
- self.Bu1.configure(foreground="#000000")
- self.Bu1.configure(highlightbackground="#d9d9d9")
- self.Bu1.configure(highlightcolor="black")
- self.Bu1.configure(pady="0")
- self.Bu1.configure(text='''1''')
- self.Bu2 = Button(top, command = Button2)
- self.Bu2.place(relx=0.25, rely=0.79, height=34, width=78)
- self.Bu2.configure(activebackground="#d9d9d9")
- self.Bu2.configure(activeforeground="#000000")
- self.Bu2.configure(background="#d9d9d9")
- self.Bu2.configure(disabledforeground="#a3a3a3")
- self.Bu2.configure(font="Font10")
- self.Bu2.configure(foreground="#000000")
- self.Bu2.configure(highlightbackground="#d9d9d9")
- self.Bu2.configure(highlightcolor="black")
- self.Bu2.configure(pady="0")
- self.Bu2.configure(text='''2''')
- self.Bu3 = Button(top, command = Button3)
- self.Bu3.place(relx=0.5, rely=0.79, height=34, width=78)
- self.Bu3.configure(activebackground="#d9d9d9")
- self.Bu3.configure(activeforeground="#000000")
- self.Bu3.configure(background="#d9d9d9")
- self.Bu3.configure(disabledforeground="#a3a3a3")
- self.Bu3.configure(font="Font10")
- self.Bu3.configure(foreground="#000000")
- self.Bu3.configure(highlightbackground="#d9d9d9")
- self.Bu3.configure(highlightcolor="black")
- self.Bu3.configure(pady="0")
- self.Bu3.configure(text='''3''')
- self.Bu4 = Button(top, command = Button4)
- self.Bu4.place(relx=0.0, rely=0.69, height=34, width=78)
- self.Bu4.configure(activebackground="#d9d9d9")
- self.Bu4.configure(activeforeground="#000000")
- self.Bu4.configure(background="#d9d9d9")
- self.Bu4.configure(disabledforeground="#a3a3a3")
- self.Bu4.configure(font="Font10")
- self.Bu4.configure(foreground="#000000")
- self.Bu4.configure(highlightbackground="#d9d9d9")
- self.Bu4.configure(highlightcolor="black")
- self.Bu4.configure(pady="0")
- self.Bu4.configure(text='''4''')
- self.Bu5 = Button(top, command = Button5)
- self.Bu5.place(relx=0.25, rely=0.69, height=34, width=78)
- self.Bu5.configure(activebackground="#d9d9d9")
- self.Bu5.configure(activeforeground="#000000")
- self.Bu5.configure(background="#d9d9d9")
- self.Bu5.configure(disabledforeground="#a3a3a3")
- self.Bu5.configure(font="Font10")
- self.Bu5.configure(foreground="#000000")
- self.Bu5.configure(highlightbackground="#d9d9d9")
- self.Bu5.configure(highlightcolor="black")
- self.Bu5.configure(pady="0")
- self.Bu5.configure(text='''5''')
- self.Bu6 = Button(top, command = Button6)
- self.Bu6.place(relx=0.5, rely=0.69, height=34, width=78)
- self.Bu6.configure(activebackground="#d9d9d9")
- self.Bu6.configure(activeforeground="#000000")
- self.Bu6.configure(background="#d9d9d9")
- self.Bu6.configure(disabledforeground="#a3a3a3")
- self.Bu6.configure(font="Font10")
- self.Bu6.configure(foreground="#000000")
- self.Bu6.configure(highlightbackground="#d9d9d9")
- self.Bu6.configure(highlightcolor="black")
- self.Bu6.configure(pady="0")
- self.Bu6.configure(text='''6''')
- self.Bu7 = Button(top, command = Button7)
- self.Bu7.place(relx=0.0, rely=0.58, height=34, width=78)
- self.Bu7.configure(activebackground="#d9d9d9")
- self.Bu7.configure(activeforeground="#000000")
- self.Bu7.configure(background="#d9d9d9")
- self.Bu7.configure(disabledforeground="#a3a3a3")
- self.Bu7.configure(font="Font10")
- self.Bu7.configure(foreground="#000000")
- self.Bu7.configure(highlightbackground="#d9d9d9")
- self.Bu7.configure(highlightcolor="black")
- self.Bu7.configure(pady="0")
- self.Bu7.configure(text='''7''')
- self.Bu8 = Button(top, command = Button8)
- self.Bu8.place(relx=0.25, rely=0.58, height=34, width=78)
- self.Bu8.configure(activebackground="#d9d9d9")
- self.Bu8.configure(activeforeground="#000000")
- self.Bu8.configure(background="#d9d9d9")
- self.Bu8.configure(disabledforeground="#a3a3a3")
- self.Bu8.configure(font="Font10")
- self.Bu8.configure(foreground="#000000")
- self.Bu8.configure(highlightbackground="#d9d9d9")
- self.Bu8.configure(highlightcolor="black")
- self.Bu8.configure(pady="0")
- self.Bu8.configure(text='''8''')
- self.Bu9 = Button(top, command = Button9)
- self.Bu9.place(relx=0.5, rely=0.58, height=34, width=78)
- self.Bu9.configure(activebackground="#d9d9d9")
- self.Bu9.configure(activeforeground="#000000")
- self.Bu9.configure(background="#d9d9d9")
- self.Bu9.configure(disabledforeground="#a3a3a3")
- self.Bu9.configure(font="Font10")
- self.Bu9.configure(foreground="#000000")
- self.Bu9.configure(highlightbackground="#d9d9d9")
- self.Bu9.configure(highlightcolor="black")
- self.Bu9.configure(pady="0")
- self.Bu9.configure(text='''9''')
- self.CE = Button(top, command = ClearAll)
- self.CE.place(relx=0.0, rely=0.48, height=34, width=78)
- self.CE.configure(activebackground="#d9d9d9")
- self.CE.configure(activeforeground="#000000")
- self.CE.configure(background="#d9d9d9")
- self.CE.configure(disabledforeground="#a3a3a3")
- self.CE.configure(font="Font10")
- self.CE.configure(foreground="#000000")
- self.CE.configure(highlightbackground="#d9d9d9")
- self.CE.configure(highlightcolor="black")
- self.CE.configure(pady="0")
- self.CE.configure(relief=GROOVE)
- self.CE.configure(text='''CE''')
- self.ClearCurrent = Button(top, command = ClearAll)
- self.ClearCurrent.place(relx=0.25, rely=0.48, height=34, width=78)
- self.ClearCurrent.configure(activebackground="#d9d9d9")
- self.ClearCurrent.configure(activeforeground="#000000")
- self.ClearCurrent.configure(background="#d9d9d9")
- self.ClearCurrent.configure(disabledforeground="#a3a3a3")
- self.ClearCurrent.configure(font="Font10")
- self.ClearCurrent.configure(foreground="#000000")
- self.ClearCurrent.configure(highlightbackground="#d9d9d9")
- self.ClearCurrent.configure(highlightcolor="black")
- self.ClearCurrent.configure(pady="0")
- self.ClearCurrent.configure(relief=GROOVE)
- self.ClearCurrent.configure(text='''C''')
- self.BckSpc = Button(top, command = BackSpace)
- self.BckSpc.place(relx=0.5, rely=0.48, height=34, width=78)
- self.BckSpc.configure(activebackground="#d9d9d9")
- self.BckSpc.configure(activeforeground="#000000")
- self.BckSpc.configure(background="#d9d9d9")
- self.BckSpc.configure(disabledforeground="#a3a3a3")
- self.BckSpc.configure(font="Font10")
- self.BckSpc.configure(foreground="#000000")
- self.BckSpc.configure(highlightbackground="#d9d9d9")
- self.BckSpc.configure(highlightcolor="black")
- self.BckSpc.configure(pady="0")
- self.BckSpc.configure(relief=GROOVE)
- self.BckSpc.configure(text='''↩''')
- self.PlusMinus = Button(top)
- self.PlusMinus.place(relx=0.0, rely=0.9, height=34, width=78)
- self.PlusMinus.configure(activebackground="#d9d9d9")
- self.PlusMinus.configure(activeforeground="#000000")
- self.PlusMinus.configure(background="#d9d9d9")
- self.PlusMinus.configure(disabledforeground="#a3a3a3")
- self.PlusMinus.configure(font="Font10")
- self.PlusMinus.configure(foreground="#000000")
- self.PlusMinus.configure(highlightbackground="#d9d9d9")
- self.PlusMinus.configure(highlightcolor="black")
- self.PlusMinus.configure(pady="0")
- self.PlusMinus.configure(relief=GROOVE)
- self.PlusMinus.configure(text='''±''')
- self.Decimal = Button(top, command = Decimal)
- self.Decimal.place(relx=0.5, rely=0.9, height=34, width=78)
- self.Decimal.configure(activebackground="#d9d9d9")
- self.Decimal.configure(activeforeground="#000000")
- self.Decimal.configure(background="#d9d9d9")
- self.Decimal.configure(disabledforeground="#a3a3a3")
- self.Decimal.configure(font="Font10")
- self.Decimal.configure(foreground="#000000")
- self.Decimal.configure(highlightbackground="#d9d9d9")
- self.Decimal.configure(highlightcolor="black")
- self.Decimal.configure(pady="0")
- self.Decimal.configure(relief=GROOVE)
- self.Decimal.configure(text='''.''')
- self.Equals = Button(top, command = Equals)
- self.Equals.place(relx=0.75, rely=0.9, height=34, width=78)
- self.Equals.configure(activebackground="#d9d9d9")
- self.Equals.configure(activeforeground="#000000")
- self.Equals.configure(background="#d9d9d9")
- self.Equals.configure(disabledforeground="#a3a3a3")
- self.Equals.configure(font="Font10")
- self.Equals.configure(foreground="#000000")
- self.Equals.configure(highlightbackground="#d9d9d9")
- self.Equals.configure(highlightcolor="black")
- self.Equals.configure(pady="0")
- self.Equals.configure(relief=GROOVE)
- self.Equals.configure(text='''=''')
- self.Add = Button(top, command = Add)
- self.Add.place(relx=0.75, rely=0.79, height=34, width=78)
- self.Add.configure(activebackground="#d9d9d9")
- self.Add.configure(activeforeground="#000000")
- self.Add.configure(background="#d9d9d9")
- self.Add.configure(disabledforeground="#a3a3a3")
- self.Add.configure(font="Font10")
- self.Add.configure(foreground="#000000")
- self.Add.configure(highlightbackground="#d9d9d9")
- self.Add.configure(highlightcolor="black")
- self.Add.configure(pady="0")
- self.Add.configure(relief=GROOVE)
- self.Add.configure(text='''+''')
- self.Subtract = Button(top, command = Subtract)
- self.Subtract.place(relx=0.75, rely=0.69, height=34, width=78)
- self.Subtract.configure(activebackground="#d9d9d9")
- self.Subtract.configure(activeforeground="#000000")
- self.Subtract.configure(background="#d9d9d9")
- self.Subtract.configure(disabledforeground="#a3a3a3")
- self.Subtract.configure(font="Font10")
- self.Subtract.configure(foreground="#000000")
- self.Subtract.configure(highlightbackground="#d9d9d9")
- self.Subtract.configure(highlightcolor="black")
- self.Subtract.configure(pady="0")
- self.Subtract.configure(relief=GROOVE)
- self.Subtract.configure(text='''-''')
- self.Multiply = Button(top, command = Multiply)
- self.Multiply.place(relx=0.75, rely=0.58, height=34, width=78)
- self.Multiply.configure(activebackground="#d9d9d9")
- self.Multiply.configure(activeforeground="#000000")
- self.Multiply.configure(background="#d9d9d9")
- self.Multiply.configure(disabledforeground="#a3a3a3")
- self.Multiply.configure(font="Font10")
- self.Multiply.configure(foreground="#000000")
- self.Multiply.configure(highlightbackground="#d9d9d9")
- self.Multiply.configure(highlightcolor="black")
- self.Multiply.configure(pady="0")
- self.Multiply.configure(relief=GROOVE)
- self.Multiply.configure(text='''x''')
- self.Divide = Button(top, command = Divide )
- self.Divide.place(relx=0.75, rely=0.48, height=34, width=78)
- self.Divide.configure(activebackground="#d9d9d9")
- self.Divide.configure(activeforeground="#000000")
- self.Divide.configure(background="#d9d9d9")
- self.Divide.configure(disabledforeground="#a3a3a3")
- self.Divide.configure(font="Font10")
- self.Divide.configure(foreground="#000000")
- self.Divide.configure(highlightbackground="#d9d9d9")
- self.Divide.configure(highlightcolor="black")
- self.Divide.configure(pady="0")
- self.Divide.configure(relief=GROOVE)
- self.Divide.configure(text='''÷''')
- self.Percentage = Button(top, command = Percentage)
- self.Percentage.place(relx=0.0, rely=0.37, height=34, width=78)
- self.Percentage.configure(activebackground="#d9d9d9")
- self.Percentage.configure(activeforeground="#000000")
- self.Percentage.configure(background="#d9d9d9")
- self.Percentage.configure(disabledforeground="#a3a3a3")
- self.Percentage.configure(font="Font10")
- self.Percentage.configure(foreground="#000000")
- self.Percentage.configure(highlightbackground="#d9d9d9")
- self.Percentage.configure(highlightcolor="black")
- self.Percentage.configure(pady="0")
- self.Percentage.configure(relief=GROOVE)
- self.Percentage.configure(text='''%''')
- self.SquareRoot = Button(top, command = SquareRoot)
- self.SquareRoot.place(relx=0.25, rely=0.37, height=34, width=78)
- self.SquareRoot.configure(activebackground="#d9d9d9")
- self.SquareRoot.configure(activeforeground="#000000")
- self.SquareRoot.configure(background="#d9d9d9")
- self.SquareRoot.configure(disabledforeground="#a3a3a3")
- self.SquareRoot.configure(font="Font10")
- self.SquareRoot.configure(foreground="#000000")
- self.SquareRoot.configure(highlightbackground="#d9d9d9")
- self.SquareRoot.configure(highlightcolor="black")
- self.SquareRoot.configure(pady="0")
- self.SquareRoot.configure(relief=GROOVE)
- self.SquareRoot.configure(text='''√''')
- self.Modulo = Button(top, command = Modulo)
- self.Modulo.place(relx=0.5, rely=0.37, height=34, width=78)
- self.Modulo.configure(activebackground="#d9d9d9")
- self.Modulo.configure(activeforeground="#000000")
- self.Modulo.configure(background="#d9d9d9")
- self.Modulo.configure(disabledforeground="#a3a3a3")
- self.Modulo.configure(font="Font10")
- self.Modulo.configure(foreground="#000000")
- self.Modulo.configure(highlightbackground="#d9d9d9")
- self.Modulo.configure(highlightcolor="black")
- self.Modulo.configure(pady="0")
- self.Modulo.configure(relief=GROOVE)
- self.Modulo.configure(text='''mod''')
- self.FloorDivide = Button(top, command = FloorDivide)
- self.FloorDivide.place(relx=0.75, rely=0.37, height=34, width=78)
- self.FloorDivide.configure(activebackground="#d9d9d9")
- self.FloorDivide.configure(activeforeground="#000000")
- self.FloorDivide.configure(background="#d9d9d9")
- self.FloorDivide.configure(disabledforeground="#a3a3a3")
- self.FloorDivide.configure(font="Font10")
- self.FloorDivide.configure(foreground="#000000")
- self.FloorDivide.configure(highlightbackground="#d9d9d9")
- self.FloorDivide.configure(highlightcolor="black")
- self.FloorDivide.configure(pady="0")
- self.FloorDivide.configure(relief=GROOVE)
- self.FloorDivide.configure(text='''f÷''')
- @staticmethod
- def popup1(event):
- Popupmenu1 = Menu(root, tearoff=0)
- Popupmenu1.configure(activebackground="#f9f9f9")
- Popupmenu1.configure(activeborderwidth="1")
- Popupmenu1.configure(activeforeground="black")
- Popupmenu1.configure(background="#d9d9d9")
- Popupmenu1.configure(borderwidth="1")
- Popupmenu1.configure(disabledforeground="#a3a3a3")
- Popupmenu1.configure(font="{Segoe UI} 9")
- Popupmenu1.configure(foreground="black")
- Popupmenu1.post(event.x_root, event.y_root)
- if __name__ == '__main__':
- vp_start_gui()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement