I have some code:
import tkinter as tk
from tkinter import ttk
window = tk.Tk()
v = tk.IntVar()
v.set(1)
x1String = "x1: "
x2String = "x2: "
y1String = "y1: "
y2String = "y2: "
window.geometry("640x860")
submit = tk.Button(window, text="Run Equasion",command = lambda:run())
inputtxt = tk.Text(window, height = 10,
width = 25,
bg = "light yellow")
greeting = tk.Label(text="Math Calculator")
greeting.pack()
entry = tk.Entry(fg="yellow", bg="blue", width=50)
lineBr = ttk.Separator(window, orient='horizontal')
lineBr.pack(fill='x')
Formulas = [("Distance Formula", 101),
("Pythagorean Theorem", 102),
("Area of a Sphere", 103),
("Volume of a Sphere", 104),
("Midpoint Formula", 105)]
def ShowChoice():
global submit
if v.get() == 101:
inputtxt.insert(tk.END, "distance()")
elif v.get() == 102:
inputtxt.insert(tk.END, "pathaga()")
elif v.get() == 103:
inputtxt.insert(tk.END, "AreaSphere()")
elif v.get() == 104:
inputtxt.insert(tk.END, "VolumeSphere()")
elif v.get() == 105:
inputtxt.insert(tk.END, "Midpoint()")
return v.get()
def run():
return None
for mathEqu, val in Formulas:
tk.Radiobutton(window,
text=mathEqu,
indicatoron = 0,
width = 20,
padx = 20,
variable=v,
command=ShowChoice,
value=val).pack(anchor=tk.W)
tk.Label(text="\n").pack()
inputtxt.pack()
submit.pack()
window.mainloop()
and I want to call a function, with parameters that are written by the user, to make my calculator. If you click on one of the radio boxes then it will write a function, that goes with the equation. I want the user to put parameters in the functions to then run the functions to get the answer to the equasion.
[formatted by admin]