我是 python 新手,正在尝试构建一个小应用程序。它需要是一个 GUI 应用程序,我想用 docker 将它容器化。我收到以下错误,找不到解决方案
No protocol specified
No protocol specified
Traceback (most recent call last):
File "tkinker.py", line 7, in <module>
tinker = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1818, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":0.0"
Run Code Online (Sandbox Code Playgroud)
它在本地启动,但不会在 docker 中启动。我的操作系统是 Xubuntu。
我创建了一个示例应用程序(如下),请参阅 run-test.sh https://github.com/jeremysells/test/tree/master/docker-tkinter