【发布时间】:2021-01-04 01:36:04
【问题描述】:
我尝试在 Python 服务器版本上使用 Tkinter。 (Linux) 但我失败了。如何在 Python 服务器版本上使用 tkinter?
-----------------------------------------------------------------------------
import tkinter ; window = tkinter.Tk()
-----------------------------------------------------------------------------
TclError Traceback (most recent call last)
<ipython-input-16-c9e945514158> in <module>
1 import tkinter
----> 2 window = tkinter.Tk()
~/anaconda3/lib/python3.7/tkinter/__init__.py in __init__(self, screenName, baseName, className, useTk, sync, use)
2021 baseName = baseName + ext
2022 interactive = 0
-> 2023 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
2024 if useTk:
2025 self._loadtk()
TclError: no display name and no $DISPLAY environment variable
【问题讨论】:
-
您的服务器是否运行图形桌面环境?