我在python上做一个程序,这是一个邮箱,但我一直收到这个错误

时间:2016-01-05 14:35:03

标签: python exception tkinter callback nonetype

我来自葡萄牙,所以我的英语可能不是最好的,但我希望你明白。

我在tkinter上制作了我的邮箱中的代码:

from gestor import Mensagem
from gestor import CaixaDeCorreio
from gestor import Utilizador
import time
import os
from tkinter import*
dic={}

class window():

def __init__(self,mGui):
    self.utilizadores = []
    self.passwords = []               

    self.textEcra=Label(mGui,text='Login na Caixa de Correio',fg='blue',font = ('Arial','15','bold')).pack()

    self.textNome=Label(mGui,text='Utilizador',font = ('Arial','12','normal')).pack() #(side=LEFT)

    self.campNome=Entry(mGui).pack()

    self.textPassword =Label(mGui,text='Password',font = ('Arial','12','normal')).pack() #(side=LEFT)

    self.campPassword = Entry(mGui,show='*').pack()

    self.botao1=Button(mGui,text ='Entrar',font = ('Arial','12','normal'),command = self.verificacao).place(x=80,y=160)

    self.botao2=Button(mGui,text ='Registar',font = ('Arial','12','normal'),command = self.registo).place(x=140,y=160)




def verificacao(self):
    utilizador = self.campNome.get()
    '''if utilizador == "":
        messagebox.showinfo("Introduza um nome de utilizador!")
    else:
        pass'''
    password = self.campPassword.get()
    if utilizador in self.utilizadores and password in self.passwords:
        print("Acesso garantido!")
        novaMsg()   
        root.destroy()
    else:
        print("Por favor faça o resgisto!")

def registo(self,*args):
    utilizador = self.campNome.get()
    self.utilizadores.append(utilizador)
    password = self.campPassword.get()
    self.passwords.append(password)
    print("Registado com sucesso!")


mGui=Tk()
mGui.geometry('300x300+400+300')
mGui.title('Caixa de Correio')
window(mGui)
mGui.mainloop()

窗口打开,我可以插入用户名和密码但是当我按下按钮输入时会出现此错误:

Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\rosin\AppData\Local\Programs\Python\Python35-32\lib\tkinter\__init__.py", line 1549, in __call__
return self.func(*args)
 File "x-wingide-python-shell://86084224/2", line 50, in verificacao
AttributeError: 'NoneType' object has no attribute 'get'

我一直在论坛上搜索类似的错误,但我无法解决这个问题。在此先感谢您的帮助。代码上有一些葡萄牙语单词,如果您不理解任何帖子,请。我几乎都会上网!

来自亚速尔群岛。

0 个答案:

没有答案