我正在尝试绘制一个简单的线条系统,但是当我尝试在终端(运行 OS X Lion)或 DrPython 中运行代码时,我收到一个错误(CGContextRestoreGState:无效上下文 0x0)。我正在运行 python 2.7。
import pygame as pg
pg.init()
screen = pg.display.set_mode((640,480))
l1 = 1.0 * L
l2 = 0.5377 * L
l3 = 0.2867 * L
hip = (100,100)
knee = (hip[0] + math.sqrt(2) * l1, hip[1] + math.sqrt(2) * l1)
ankle = (knee[0] + math.sqrt(2) * l2, knee[1] + math.sqrt(2) * l2)
toe = (ankle[0] + l3, ankle[1])
pg.draw.lines(screen, (0, 0, 0), False, [hip, knee, ankle, toe], 1)
while True:
for event in pg.event.get():
if event.type == pg.QUIT:
raise SystemExit