小编And*_*tes的帖子

"Tkinter"未定义,但它正在导入

就像我有这个代码我正在编辑/修改以使其工作,任何帮助?

继承人我的错误

Traceback (most recent call last):
  File "C:\Users\Andrew\Desktop\Injector.py", line 42, in <module>
    f = Injector()
  File "C:\Users\Andrew\Desktop\Injector.py", line 18, in __init__
    self.__openInjector()
  File "C:\Users\Andrew\Desktop\Injector.py", line 33, in __openInjector
    Tkinter.Button(root, text='Inject!', command=self.runInjectorCode).pack()
NameError: name 'Tkinter' is not defined
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

try:
    # for Python2
    from Tkinter import *
except ImportError:
    # for Python3
    from tkinter import *

class Injector:

    def __openInjector(self):
        root = Tk()
        root.geometry('600x400')
        root.title('Toontown Rewritten Injector')
        root.resizable(False, False)

    def __init__(self):
        self.code = ''
        self.__openInjector()

    def runInjectorCode(self):
        exec(self.code.get(1.0, 'end'), globals()) …
Run Code Online (Sandbox Code Playgroud)

python tkinter

1
推荐指数
1
解决办法
390
查看次数

标签 统计

python ×1

tkinter ×1