[英]Tkinter Import Syntax Error Python
每當我嘗試導入tkinter模塊時,我都會收到錯誤消息。 我正在使用Python 3.4,因此大寫字母T不是問題。
from tkinter import *
root = Tk()
root.mainloop()
它拋出類似以下的錯誤:
Traceback (most recent call last):
File "<string>", line 420, in run_nodebug
File "<module1>", line 11, in <module>
File "C:\Python34\lib\tkinter\__init__.py", line 3372
t self.tk.call(('image', 'create', imgtype, name,) + options)
^
SyntaxError: invalid syntax
謝謝您的幫助!
這個問題似乎在init文件本身中已經存在。 只需轉到您PC中的文件即可。
C:\Python34\lib\tkinter\__init__.py
使用Idle或您使用的任何IDE編輯該init .py。 接下來轉到行號3372並從行中刪除該不需要的字符't'
t self.tk.call(('image', 'create', imgtype, name,) + options)
它將為您完成工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.