1
votes

The following code+error is a component of a logging in portal, I'm using a theme named sun valley, and I think its because of that particular reason.

def newWin():

    zz = tk.Tk()
    zz.title('account sign in')
    zz.iconbitmap(r'C:\Users\python\Downloads\logo.ico')

    

newwindowbtn = ttk.Label(root, text="Already have an account? Just sign in then!",
                font=('helvetica', 10, 'bold')).place(x=25, y=600)

#bind label
newwindowbtn.bind("<Button-1>", newWin)

Output:

hyperbtn.bind("", new_window) AttributeError: 'NoneType' object has no attribute 'bind'

1

1 Answers

0
votes

Now this works fine.

This error is because you assign the newwindowbtn to a ttk.label.place() where place return None which is cause this error you need to assign newwindowbtn to ttk.label and in next line you can use newwindowbtn.place(x=25, y=600).

def newWin():

    zz = tk.Tk()
    zz.title('account sign in')
    zz.iconbitmap(r'C:\Users\python\Downloads\logo.ico')

    

newwindowbtn = ttk.Label(root, text="Already have an account? Just sign in then!",
                font=('helvetica', 10, 'bold'))

newwindowbtn.place(x=25, y=600)

#bind label
newwindowbtn.bind("<Button-1>", newWin)