I want to bind a function to open a new window with form to fill details with a 'Register' button. But even after defining the register() function, it gives NameError when I click the button.
Tried with: 1) 'command=function" method 2) btn.bind() method Still giving error.
register_btn = Button(main_screen,text = "Register", bg = "grey",width = "30", height = "2")
register_btn.pack()
register_btn.bind("<Button-1>", register)
#function
def register(event):
---
Exception has occurred: NameError name 'register' is not defined