0

Im from portugal so my english might not be the best but I hope you understand.

I have this code from my mailbox made on 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()

And the windows opens and I can insert user and password but when I press button enter this error appears:

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'

I have been searching on forum from similiar errors but I can't fix this one. Thanks in advance for any help. There are some portuguese words on code, please if you don't understand any post it. I will be online almost the time!

Regards from Azorean Islands.

  • I read some posts on forum, some said to add *args on function, in this case I added on verificacao(), I tried aswell on class, others functions but none of them seem to work. This code had initial on window class a few self.frames to be used on interface like this and was working: self.frame1=Frame(tk) self.frame1.pack() self.frame2=Frame(tk) self.frame2.pack() I made those changes which u can see on my question and now i don't know why it doesnt work. Instead of self.frames i changed to name of interface (mGui). – Filipe Rosa Jan 05 '16 at 14:49
  • 1
    This question specifically answers your exact error: [tkinter-attributeerror-nonetype-object-has-no-attribute-get](http://stackoverflow.com/questions/1101750/tkinter-attributeerror-nonetype-object-has-no-attribute-get) – Bryan Oakley Jan 05 '16 at 15:06
  • Thank you! Already working fine! – Filipe Rosa Jan 05 '16 at 17:26

0 Answers0