Okay so - I have under 24 hours of experience with programming - this is my second day - so please don't slaughter me. Yesterday I spend almost all day trying to figure this out, but all the concepts are still a bit slippery to me - I hope somebody is willing to help.
I want to make a calculation based on the inputs of several Entry widgets and then make it display the result as an output in a Label (or just text).
This is a piece of the code
from tkinter import *
from tkinter.messagebox import *
root = Tk()
root.title("StoGram 1.0")
# Entry
symentry = Entry(root, width=10) #Symbol
enentry = Entry(root, width=10) #Entry
slentry = Entry(root, width=10) #Stop Loss
tpentry = Entry(root, width=10) #Take Profit
kbentry = Entry(root, width=10) #Bank Balance
rentry = Entry(root, width=10) #Max Risk
symentry.grid(row=1, column=3) #Symbol
enentry.grid(row=2, column=1) #Entry
slentry.grid(row=3, column=1) #Stop Loss
tpentry.grid(row=4, column=1) #Take Profit
kbentry.grid(row=5, column=1) #Bank Balance
kbentry.insert(0, "100000")
rentry.grid(row=6, column=1) #Max Risk
rentry.insert(0, "1")
# Calculate button to grid
calculate_Button = Button(root, text='Calculate', command=answer)
# Calculate button to grid
calculate_button.grid(row="4", column="3")
I have tried to figure out what to do with # Calculate button to grid calculate_Button = Button(root, text='Calculate', command=answer)
and in trying that I have played around with
def answer():
as well as int
and str
.get()
and a couple of other things.
But really, I am just a monkey with a wrench hammer trying to make stuff work and I have no idea what I am doing.
Any advice is much appreciated.