【发布时间】:2018-04-21 08:56:08
【问题描述】:
我想要做的是将一个矩形分配给一个变量而不在屏幕上绘制它。我想知道如何做到这一点。这是我当前将 20x20 白色矩形分配给“myRect”的代码:
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((50, 50))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
myRect = pygame.draw.rect(screen, (255, 255, 255), (0, 0, 20, 20))
【问题讨论】:
-
这个问题实际上是stackoverflow.com/q/26831033/6220679 的副本,但是除了martineau 的评论之外,那里的答案很糟糕。
标签: python python-3.x pygame