NameError:名称“ txtDisplay”未定义

时间:2019-04-25 20:50:00

标签: python python-3.x tkinter

我使用python 3中的tkinter模块制作了一个科学的计算器。当我运行代码时,它运行良好,直到按下计算器上的任意键,然后出现以下错误:

C:\Users\Tauseef\AppData\Local\Programs\Python\Python37-32\python.exe C:/Users/Tauseef/Desktop/scratch.py
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\Tauseef\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__
    return self.func(*args)
  File "C:/Users/Tauseef/Desktop/scratch.py", line 54, in <lambda>
    btn[i]["command"] = lambda x = numberpad[i]: added_value.numberEnter(x)
  File "C:/Users/Tauseef/Desktop/scratch.py", line 26, in numberEnter
    firstnum = txtDisplay.get()
NameError: name 'txtDisplay' is not defined

0 个答案:

没有答案