def Degree_one():
A = 0
entered_num = ''
def button_click(num):
global entered_num
entered_num += str(int(num))
entry_var.set(entered_num)
save_Clicked = None
def add_decimal():
global entered_num
if '.' not in entered_num:
entered_num += '.'
entry_var.set(entered_num)
def save_num():
global entered_num
global save_Clicked
print("Number saved:", entered_num)
save_Clicked = True
Degree_onewn = tk.Tk()
Degree_onewn.title("Degree One")
label1 = tk.Label(Degree_onewn, text="Ax+b = 0", font=("arial", 20))
label1.grid(row=0, column=0, columnspan=3)
label2 = tk.Label(Degree_onewn, text="Enter A Value", font=("arial", 20))
label2.grid(row=1, column=0, columnspan=3)
entered_number = ""
entry_var = tk.StringVar()
entry = tk.Entry(Degree_onewn, textvariable=entry_var, font=("arial", 20), width=10)
entry.grid(row=2, column=0, columnspan=3)
buttons = []
for i in range(1, 10):
button = tk.Button(Degree_onewn, text=str(i), font=("arial", 20), command=lambda i=i: button_click(i), width=10)
buttons.append(button)
row_num = 3
col_num = 0
for i, button in enumerate(buttons):
button.grid(row=row_num, column=col_num)
col_num += 1
if col_num == 3:
col_num = 0
row_num += 1
decimal_button = tk.Button(Degree_onewn, text=".", font=("arial", 20), command=add_decimal, width=10)
decimal_button.grid(row=6, column=0)
save_button = tk.Button(Degree_onewn, text="Save", font=("arial", 20), command=save_num, width=10)
save_button.grid(row=6, column=1)
while not save_Clicked:
Degree_onewn.update()
if save_Clicked:
Degree_onewn.destroy()
A = entry
You have not provided enough information for us to be able to help you.
What do you expect to happen when you run this code?
What happens instead?
Welcome aboard!
Can you provide the list of errors when this is run? We will need to see the error and the line the error is on.
Thanks sloved