Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

tkinter trig calculator

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')
#App code after here
Formulas = [("Distance Formula", 101),
             ("Pythagorean Theorem", 102),
            ("Area of a Sphere", 103),
            ("Volume of a Sphere", 104),
            ("Midpoint Formula", 105)]


def ShowChoice():
    global submit
    #print(string)
    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 print(inputtxt.get("1.0", "end"))


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="
").pack()

inputtxt.pack()

submit.pack()
#x1 = x1Box.get("1.0", "end-1c")

window.mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: unpack list python 
Python :: discord rich presence python 
Python :: Convert matlab to Python Reddit 
Python :: instaed of: newlist = [] for word in wordlist: newlist.append(word.upper()) 
Python :: pandas to sql arabic 
Python :: regression avec sklearn best 
Python :: How to play audio in background 
Python :: colorgram.py 1.2.0 
Python :: How to check whether a nested hash element exists in python 
Python :: FinnT730 
Python :: # https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html#specifying-and-constructing-data-types 
Python :: dataflair python 
Python :: how to insert value in admin panel in django 
Python :: revit dynamo select all categories 
Python :: how to kick and ban members with discord.py 
Python :: keras model predict list of input tensors 
Python :: python set prcess name 
Python :: 1038 solution python 
Python :: python empty array length n grepper 
Python :: django edit model without loading from db 
Python :: return positon of ele in list python 
Python :: move to next iteration of for loop python 
Python :: python loop increment by 2 
Python :: hide model field form 
Python :: How determine if a number is even or odd using bitwise operator 
Python :: np.ptp 
Python :: How To Remove Elements From a Set using discard() function in python 
Python :: Create Admin Interface For Objects 
Python :: flask-sqlalchemy inheritance 
Python :: django url wildcard 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =