无法在 cygwin 中 运行 python 图形
Unable to run python graphics in cygwin
我试过:
from graphics import *
win = GraphWin()
pt = Point(100, 50)
pt.draw(win)
cir = Circle(pt, 25)
cir.draw(win)
cir.setOutline('red')
cir.setFill('blue')
然而,无论我从网上尝试在 cygwin 上安装什么,它都会给出:
Traceback (most recent call last):
File "observe.py", line 2, in <module>
from graphics import *
File "/home/user/graphics.py", line 164, in <module>
_root = tk.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1814, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
当我移动到 Ubuntu 或 Mac 时,它似乎有不同的行为。
您确定您的 X 服务器是 运行 吗?
应该这样做
[...] by using the "XWin Server" shortcut under "Cygwin-X" on
the Start Menu
我试过:
from graphics import *
win = GraphWin()
pt = Point(100, 50)
pt.draw(win)
cir = Circle(pt, 25)
cir.draw(win)
cir.setOutline('red')
cir.setFill('blue')
然而,无论我从网上尝试在 cygwin 上安装什么,它都会给出:
Traceback (most recent call last):
File "observe.py", line 2, in <module>
from graphics import *
File "/home/user/graphics.py", line 164, in <module>
_root = tk.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1814, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
当我移动到 Ubuntu 或 Mac 时,它似乎有不同的行为。
您确定您的 X 服务器是 运行 吗?
应该这样做
[...] by using the "XWin Server" shortcut under "Cygwin-X" on the Start Menu