Exception in tkinter callback traceback most recent call last ошибка

Операционная ситемма Kali Linux Python 3.x Основная библиотека Tkinter, re для проверки пароля на правильность написания,functools для параметров функций В коде два главных для меня вопроса это: а при регистрации нового пользователя в момент попытке ввода пароля вылезает странная...
from tkinter import *
from functools import partial
from tkinter.messagebox import *
import re




 

#текст
a="Авторизируйтесь" #Зоглоловок окна
b="Вход в приложение"#Текст в приложениии
c="Пожайлуста введите данные:"#Текст в приложение 2
d="Вы зарагистрированны?"#Вопрос о регистрации пользовотеля
e="Придумайте надежный логин и пароль"
f="Регистрация"


#Логины
namelist = ["ilia"]
#Пароли
passwdlist= ["2" "1"]

window = Tk()
window.title(a)


text1=Label(text=b)
text1.pack(fill=BOTH, expand=True)

text2=Label(text=c)
text2.pack(fill=BOTH, side=LEFT, expand=True)

entryLOGIN = Entry()
entryLOGIN.insert(0,"Логин")
entryLOGIN.pack(fill=BOTH, side=LEFT, expand=True)


entryPASS = Entry()
entryPASS.pack(fill=BOTH, side=LEFT, expand=True)
entryPASS.insert(0,"Пароль")


i=0


#Оценка стойкости пароля
def ChekDATA(entryEPASS,entryELOGIN,namelist,passwdlist):
  passw=entryEPASS.get()
  name=entryELOGIN.get()
  fl=0
  a=0
  while True:
    if (len(passw)<8):
      fl=-1
      break
    elif not re.search("[a-z]",passw):
      fl=-1
      break
    elif not re.search ("[A-Z]",passw):
      fl=-1                   
      break   
    elif not re.search("[0-9]",passw):
      fl=-1   
      break   
    elif re.search("s",passw):
      fl=-1
      break
  if fl==0:
    passwdlist.append(passw)
    a=a+1
  while True:
    if (len(name)<8):

      fl=-1
      break
    elif not re.search("[a-z]",name):
      fl=-1
      break
    elif not re.search ("[A-Z]",name):
      fl=-1                   
      break   
    elif not re.search("[0-9]",name):
      fl=-1   
      break   
    elif re.search("s",name):
      fl=-1
      break
  if fl==0:
    namelist.append(name)
    a=a+1
  if a==2:
    avt(passwdlist,namelist,a,b,c,d,e,f,window)
  else:
    showinfo("Информация","Пароль ненадежн повторите попытку")
    reg(window)   



#Приложение регистрации
def reg(window):
  window.destroy()
  Regw= Tk()
  Regw.title(f)

  text1E=Label(text=e)
  text1E.pack(fill=BOTH, expand=True)

  text2E=Label(text=c)
  text2E.pack(fill=BOTH, side=LEFT, expand=True)

  entryELOGIN = Entry()
  entryELOGIN.insert(0,"Логин")
  entryELOGIN.pack(fill=BOTH, side=LEFT, expand=True)


  entryEPASS = Entry()
  entryEPASS.pack(fill=BOTH, side=LEFT, expand=True)
  entryEPASS.insert(0,"Пароль")

  buttonREG = Button(text="Ввести",command=partial
  (
  ChekDATA,
  entryPASS,
  entryLOGIN,
  namelist,
  passwdlist
  ))
  buttonREG.pack(fill=BOTH, side=BOTTOM, expand=True)
 

def avt(passwdlist,namelist,a,b,c,d,e,f,window):   
  #Приложение авторизации
  window.destroy()
  window = Tk()
  window.title(a)


  text1=Label(text=b)
  text1.pack(fill=BOTH, expand=True)

  text2=Label(text=c)
  text2.pack(fill=BOTH, side=LEFT, expand=True)

  entryLOGIN = Entry()
  entryLOGIN.insert(0,"Логин")
  entryLOGIN.pack(fill=BOTH, side=LEFT, expand=True)


  entryPASS = Entry()
  entryPASS.pack(fill=BOTH, side=LEFT, expand=True)
  entryPASS.insert(0,"Пароль")


  i=0
  #Функция авторизации и проверки паролей на подлинность
  def increase(namelist,passwdlist,entryLOGIN,entryPASS,i):
    p=entryPASS.get()
    name=entryLOGIN.get()
    
    while i<10:
      if name in namelist:
        print("имя есть")
        if p in passwdlist:
          print(a)
          window.destroy()
          main(name)
        else:
          
          entryPASS.delete(0,END)
          i=+1
      else :
        showerror(
      "Ошибка","Введен неверный логин"
      )   
        enrtyLOGIN.delete(0,END)
        i=+1
    else:
      showerror(
      "Ошибка","Попытки кончились"
      )
      


  buttonVXOD = Button(
        master=window,
        text="Войти",
        command=partial(increase,
        namelist,
        passwdlist,
        entryLOGIN,
        entryPASS,
        i
      )
    )
  buttonVXOD.pack(fill=BOTH, side=BOTTOM, expand=True)





  #Вопрос о том зарегистрирован ли пользователь
def check():
  answer = askyesno(
  title="Вопрос",
  message=d
  )
  if answer:
    avt(passwdlist,namelist,a,b,c,d,e,f,window)
  else:
    reg(window)
      
    
check()









window.mainloop()

выбивает ошибку :
“Exception in Tkinter callback
Traceback (most recent call last):
File ”C:Python27liblib-tkTkinter.py“, line 1410, in __call__
return self.func(*args)
File ”D:Институтпитон прогаosnovav2_5.py“, line 35, in tenvtwo
txt_val = float(text1.get())
TypeError: get() takes at least 2 arguments (1 given)

ну и где мне взять второй аргумент.

 # -*- coding: cp1251 -*-
# -*- coding: UTF-8 -*-
from Tkinter import *
from sys import*
def exit():
    """Выход из проги""" 
    root.destroy()    
def solver(text1):
    
   if x1 >= 0:
       x1= bin(text1)
       text = "this nuber is: %s n x1"%(text1, x1)
       return text
def solver(txt_val1):
    if x1>=0:
        x1=oct(txt_val1)
        text = "this nuber is: %s n x1"%(txt_val1, x1)
        return text
    
def inserter(value):
    """ Функция вставки информации """
    output.delete("0.0","end")
    output.insert("0.0",value)
def clear(event):
    """ Очищает поле """
    caller = event.widget
    caller.delete("0", "end")
def tenvtwo():
   
    try:
        txt_val = float(text1.get())
        inserter(solver(txt_val))
    except ValueError:
        inserter("nevernoe chislo")
def tenveight():
    try:
        txt_val1=int(text1.get())
        inserter(solver(txt_val1))
    except ValueError:
        inserter("nevernoe chislo")
def tenvsixteen():
    inserter("lol3")
def twovten():
   inserter("lol4")
    
def sixteenvten():
    inserter("lol5")
    
def twovsixteen():
    inserter("lol6")
    
def sixteenvtwo():
   inserter("lol7")
root = Tk()
root.title(u"Калькулятор систем счисления")
root.geometry('400x300')
lab = Label(root, height=1, width=10, text=u"Ввод данных")
lab.place(x=45,y=20)
lab1 = Label(root, height=1, width=10, text=u"Результат")
lab1.place(x=45,y=230)
text1=Text(root,height=1,width=10,font='Arial 14',wrap=WORD)
text1.bind("<FocusIn>", clear)
text1.place(x=45,y=50)
but2 = Button(root, bg="yellow", text=u"Выход", command=exit)
but2.place(x=350,y=250)
but3 = Button(root, bg="green", text=u"10 в 2", command = tenvtwo)
but3.place(x=45,y=90)
but4 = Button(root, bg="green", text=u"10 в 8", command = tenveight)
but4.place(x=100,y=90)
but5 = Button(root, bg="green", text=u"10 в 16", command = tenvsixteen)
but5.place(x=170,y=90)
but6 = Button(root, bg="green", text=u"2 в 10", command=twovten)
but6.place(x=240,y=90)
but7 = Button(root, bg="green", text=u"16 в 10", command=sixteenvten)
but7.place(x=45,y=120)
but8 = Button(root, bg="green", text=u"2 в 16", command=twovsixteen)
but8.place(x=100,y=120)
but9 = Button(root, bg="green", text=u"16 в 2", command=sixteenvtwo)
but9.place(x=170,y=120)
output = Text(root, font="Arial 14", height=1, width=10)
output.bind("<FocusIn>", clear)
output.place(x=48,y=250)
mainloop()

Отредактировано artez (Сен. 16, 2017 14:30:38)

from tkinter import *
from tkinter import ttk
from googletrans import Translator, LANGUAGES

root = Tk()
root.geometry(‘1080×400′)
root.resizable(0, 0)
root.title(“Python Project | Language Translator”)
root.config(bg=’ghost white’)

# heading
Label(root, text=”Where Communication Is The Key”, font=”arial 20 bold”, bg=’white smoke’).pack()
Label(root, text=”Language Translator”, font=’arial 20 bold ‘, bg=’white smoke’, width=’20’).pack(side=’bottom’)

# INPUT AND OUTPUT TEXT WIDGET
Label(root, text=”Enter Text”, font=’arial 13 bold’, bg=’white smoke’).place(x=200, y=60)
Input_text = Text(root, font=’arial 10′, height=11, wrap=WORD, padx=5, pady=5, width=60)
Input_text.place(x=30, y=100)

Label(root, text=”Output”, font=’arial 13 bold’, bg=’white smoke’).place(x=780, y=60)
Output_text = Text(root, font=’arial 10′, height=11, wrap=WORD, padx=5, pady=5, width=60)
Output_text.place(x=600, y=100)

##################
Language = list(LANGUAGES.values())

src_lang = ttk.Combobox(root, values=Language, width=22)
src_lang.place(x=20, y=60)
src_lang.set(‘choose input language’)

dest_lang = ttk.Combobox(root, values=Language, width=22)
dest_lang.place(x=890, y=60)
dest_lang.set(‘choose output language’)

######## Define function #######

def Translate():
translator = Translator()
translated = translator.Translate(text=Input_text.get(1.0, END), src=src_lang.get(), dest=dest_lang.get())
Output_text.delete(1.0, END)
Output_text.insert(END, translated.text)

########## Translate Button ########
trans_btn = Button(root, text=’Translate’, font=’arial 12 bold’, pady=5, command=Translate, bg=’royal blue1′,
activebackground=’sky blue’)
trans_btn.place(x=490, y=180)

root.mainloop()

below is the error: Please solve this

Traceback (most recent call last):
File “C:UserstahirAppDataLocalProgramsPythonPython38-32libtkinter__init__.py”, line 1883, in __call__
return self.func(*args)
File “C:/Users/tahir/PycharmProjects/firstProject/main.py”, line 43, in Translate
Output_text.insert(END, translated.text)
AttributeError: ‘NoneType’ object has no attribute ‘text’

Понравилась статья? Поделить с друзьями:
  • Exception in thread main java util inputmismatchexception ошибка
  • Exception in thread main java lang exceptionininitializererror как исправить
  • Exception in thread main java lang error unresolved compilation problem scanner cannot be resolved
  • Exception in thread main java lang error unresolved compilation problem invalid character constant
  • Exception in thread main java lang error ip helper library getipaddrtable function failed