[英]python not using tkinter 8.6 installed with homebrew on Mac
[英][mac Monterey][Python 3.10.4][tkinter 8.6] Calling tkinter askOpenfilename crashes when repeatedly creating a window
我有一个 python 程序,它允许用户重复按下一个键,该键将创建一个 tkinter window,他们可以在其中打开图像并对其进行操作。
问题是,到第三次时,tkinter 总是崩溃。
我想不通为什么..
我简化了下面的代码:
import tkinter as tk
from tkinter import filedialog
class Application(tk.Frame):
def __init__(self, root=None):
super().__init__(root)
self.root = root
filename = filedialog.askopenfilename(title='open')
def run(title):
root = tk.Tk()
root.title(title)
root.geometry(str(100) + "x" + str(100))
app = Application(root=root)
app.mainloop()
def main():
run("1")
run("2")
run("3")
run("4")
run("5")
run("6")
if __name__ == '__main__':
main()
任何帮助都会非常有用。
错误信息很长。 但这里有一个相关的部分:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000000000001c
Exception Codes: 0x0000000000000001, 0x000000000000001c
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [10115]
目前还没有解决此问题的方法。 Tk 维护人员承认了这个错误并正在努力解决它。
参考链接在这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.