0

My Code:

from tkinter import *

main_window = Tk()

# Labels
Label(main_window, text= "enter your name please enter your name").grid(row=0, column=0)
Label(main_window, text= "Whats your age").grid(row=1, column=0)

# Text input
name = Entry(main_window,width=50, borderwidth=5)
name.grid(row=0,column=1 )
age = Entry(main_window,width=50, borderwidth=5)
age.grid(row=1,column=1)

# Safe gaurds
if age <= 0:
b1 = DISABLED
else:
    def on_click():
        print(f"my name is {name.get()}, and my age is {age}")
        #Button
        b1 = Button(main_window,text="click me", command=on_click).grid(row=2,column=1)

main_window.mainloop()

My problem is for this line "if age <= 0:" the variable can't be an event so how am I supposed to make an integer?

Thank You!

(Sorry if I have done something wrong, as this is my first time on StackOverFlow)

InfoDaneMent
  • 326
  • 3
  • 18

0 Answers0