【问题标题】:"ValueError: source code string cannot contain null bytes " for tkintertkinter 的“ValueError:源代码字符串不能包含空字节”
【发布时间】:2021-11-16 00:33:34
【问题描述】:

我正在尝试学习使用此代码创建一个新窗口:

from tkinter import *

window = Tk()
window.mainloop()

但是我遇到了这个错误,

ValueError: source code string cannot contain null bytes

有人可以帮我解决这个问题吗?

【问题讨论】:

  • 请发布带有回溯的完整错误消息。你可以edit。顺便说一句,欢迎来到 Stack Overflow!如果需要提示,请查看tourHow to Ask

标签: python tkinter valueerror


【解决方案1】:

代码绝对没问题,应该会弹出一个 tkinter 窗口。您的编辑器中出现了问题。不知道我的回答是否有很大帮助,但代码很好,编辑器是问题所在。

另一个讨论这个问题的线程: Python: source code string cannot contain null bytes

【讨论】:

  • 感谢您的回复。但是链接讨论主要是关于Mac和Linux的,而且我用的是Windows
  • Windows 7 有一个答案,但在我的文件夹中找不到所需的文件
猜你喜欢
  • 1970-01-01
  • 2020-09-05
  • 1970-01-01
  • 1970-01-01
  • 2018-02-25
  • 1970-01-01
  • 2020-06-26
  • 1970-01-01
  • 2020-02-27
相关资源
最近更新 更多