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

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()

I’m still working on my little Tkinter project which is simple a logging console that prints incoming text from the serial line to a Text Widget with some coloring applied.

One question is open and can be found here: Python Tkinter Text Widget with Auto & Custom Scroll

However, even without manual scrolling (so I’m using self.text.yview(END) to auto-scroll to the bottom after inserting text with self.text.insert(END, str(parsed_line)).

The script actually works but every now and then it throws some «silent» exceptions within the Tkinter thread that does not let the whole application crash:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:Python26liblib-tkTkinter.py", line 1410, in __call__
    return self.func(*args)
  File "C:Python26liblib-tkTkinter.py", line 2813, in set
    self.tk.call((self._w, 'set') + args)
TclError: expected floating-point number but got "0.7807017543859649integer but got "end""
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:Python26liblib-tkTkinter.py", line 1410, in __call__
    return self.func(*args)
  File "C:Python26liblib-tkTkinter.py", line 2813, in set
    self.tk.call((self._w, 'set') + args)
TclError: invalid command name ".15427224integer but got "end""

It looks as if some method expected a an integer, returns the string integer but got "end" to a method that expected a float which is concatinated with the error message. The float number in that string looks like the position of the scrollbar that I have attached to my text widget:

(...)       
scrollbar = Scrollbar(root)
scrollbar.pack(side=RIGHT, fill=Y)
text = Text(wrap=WORD, yscrollcommand=scrollbar.set)
scrollbar.config(command=text.yview)
text.pack(expand=YES, fill=BOTH)
(...)

I have the feeling that it happens when a lot of lines are inserted within a short time. But since I only have one thread interacting with Tkinter this cannot be a threading issue.

I also got very random errors like that before I had applied the str() function to parsed_line in self.text.insert(END, str(parsed_line)).

This is very strange behavior and I’m wondering if anyone could explain what this is about and how to fix it.

Thanks a lot!

Exception in Tkinter callback
Traceback (most recent call last):
File «C:UsersDanilAppDataLocalProgramsPythonPython38libtkinter__init
__.py», line 1892, in __call__
return self.func(*args)
File «tt.py», line 12, in btn_click
messagebox.showinfo(title= ‘Название’, message=info_str)
NameError: name ‘messagebox’ is not defined

from tkinter import*


root = Tk()


def btn_click():
	login = loginInput.get()
	password = passField.get()

	info_str = f'Данные : {str(login)}, {str (password)}'
	messagebox.showinfo(title= 'Название', message=info_str)


	# ошибка
	# messagebox.showerror(title='', message='!!!Ошибка!!!' )


	
root['bg'] = '#fafafa'
root.title ('Название программы')
root.wm_attributes('-alpha', 1)
root.geometry('700x600') 
root.iconbitmap('C:/Users/Danil/Desktop/armchair-icon.ico')

root.resizable(width=True , height=True)

canvas = Canvas(root, height=700, width=600)
canvas.pack()


frame = Frame(root, bg='green')
frame.place(relx=0.15, rely=0.15, relwidth=0.7 , relheight=0.7 )


titel = Label(frame, text='Logerpod', bg='gray', font=40)
titel.pack()
btn= Button(frame, text='Кнопка', bg= 'blue' , command =btn_click )
btn.pack()



loginInput = Entry(frame, bg= 'white')
loginInput.pack()


passField = Entry(frame, bg= 'white', show='*')
passField.pack()



root.mainloop()

Exception in Tkinter callback
Traceback (most recent call last):
File «C:UsersClaireAppDataRoamingPythonPython36site-packagespandascoreindexesbase.py», line 2898, in get_loc
return self._engine.get_loc(casted_key)
File «pandas_libsindex.pyx», line 70, in pandas._libs.index.IndexEngine.get_loc
File «pandas_libsindex.pyx», line 101, in pandas._libs.index.IndexEngine.get_loc
File «pandas_libshashtable_class_helper.pxi», line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item
File «pandas_libshashtable_class_helper.pxi», line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: ‘Id’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File «C:Program FilesPython36libtkinter_init_.py», line 1702, in call
return self.func(*args)
File «C:UsersClaireDesktopNew folder (6)login-verification-masterrun.py», line 161, in login_submit
TrackImages(a)
File «C:UsersClaireDesktopNew folder (6)login-verification-masterrun.py», line 135, in TrackImages
aa=df.loc[df[‘Id’] == Id][‘Name’].values
File «C:UsersClaireAppDataRoamingPythonPython36site-packagespandascoreframe.py», line 2906, in getitem
indexer = self.columns.get_loc(key)
File «C:UsersClaireAppDataRoamingPythonPython36site-packagespandascoreindexesbase.py», line 2900, in get_loc
raise KeyError(key) from err
KeyError: ‘Id’

please help me with this one too.

выбивает ошибку :
“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)

  • Exception eolesyserror in module vcl50 bpl at 0001a239 ошибка при обращении к реестру ole
  • Exception eolesyserror in module orion exe at 00088efd ошибка при обращении к реестру ole
  • Exception einitexception in module gsmeta exe at 00f98dfd код ошибки 8
  • Exception eaccessviolation in module oleaut32 dll at 00004a38 gta 4 ошибка
  • Exception during execution ошибка