2017-05-07 3 views
-1

내에 속성 'GET'를이 없습니다입니다 오류가 나는 얻을 :AttributeError가 'NoneType'객체는 Tkinter 및 파이썬 3.6

Exception in Tkinter callback 
    Traceback (most recent call last): 
     File "C:\Users\Denis\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 1699, in __call__ 
     return self.func(*args) 
     File "C:\Users\Denis\Desktop\Python\Sunday Work.py", line 47, in <lambda> 
     RegistrationButton = Button(userRegister,text="Register",font=("monaco", 10),width=30,relief="groove",command=lambda: accountRegister(RegistrationUsernameEntry.get(),RegistrationPasswordEntry.get())).place(x=26,y=230) 
    AttributeError: 'NoneType' object has no attribute 'get' 

내가 사용자 계정 로그인 & 등록 시스템을 만들고 있어요 - 코드 내에서 위 나는 함수를 만들었고 로그인 화면에서 등록 단추를 클릭 할 때 최상위 창을 만들어 새 창을 열었습니다. 난 & SQL에 대한 연결을 설정 커서 등을 만들었지 만 내가 만든 항목 내에서 뭔가를 삽입하고 '등록'을 클릭 할 때마다 나는이 오류가 발생합니다. 어떤 아이디어가 잘못된 것일까 요?

이 해당 코드의 일부는

def userRegister(): 
    userRegister = Toplevel(root, bg="#a1dbcd") 
    userRegisterTitle = userRegister.title("Registration") 
    userRegister.geometry("300x300") 
    userRegister.resizable(width=False, height=False) 
    #Creates userRegister window content to register 
    RegistrationForm = Label(userRegister,text="REGISTRATION FORM",bg="#a1dbcd",font=("monaco", 20)).pack() 
    RegistrationFormDesign = Label(userRegister,bg="black",width=50).pack() 
    RegistrationFormInfo = Label(userRegister,text="To create an account fill in the form . . ",bg="#a1dbcd",font=("monaco", 9)).pack() 
    RegistrationUsername = Label(userRegister,text="Username:",bg="#a1dbcd",font=("monaco", 12)).place(x=10,y=100) 
    RegistrationUsernameEntry = Entry(userRegister,fg="black",relief="groove",width=20,font=("monaco", 10),highlightthickness=1,highlightbackground="black").place(x=10,y=130) 
    RegistrationPassword = Label(userRegister,text="Password:",bg="#a1dbcd",font=("monaco", 12)).place(x=10,y=160) 
    RegistrationPasswordEntry = Entry(userRegister,fg="black",relief="groove",show='*',width=20,font=("monaco", 10),highlightthickness=1,highlightbackground="black").place(x=10,y=190) 
    *RegistrationButton = Button(userRegister,text="Register",font=("monaco", 10),width=30,relief="groove",command=lambda: accountRegister(RegistrationUsernameEntry.get(),RegistrationPasswordEntry.get())).place(x=26,y=230)* 
    CloseButton = Button(userRegister,text="Close",font=("monaco", 10),width=30,relief="groove",command=userRegister.destroy).place(x=26,y=265) 

#Stores data inputted within entries as well as displaying a message when done 
def accountRegister(UsernameRegister,PasswordRegister): 
    print(UsernameRegister,PasswordRegister) 
    cursor.execute('''INSERT INTO users(username, password)VALUES(?, ?)''',(UsernameRegister, PasswordRegister)) 
    messagebox.showinfo("Account Registration Info", " Account is now registered! ") 
+0

.pack. 예 : [코드 여기] [이름] .pack – sago

답변

0

나는 각 하나에 .pack 배치 또는 .place하여 고정합니다.

[여기 코드] [이름] I는 각각 아래 .pack 두거나 .place하여 고정