我一直在做一些测试与pygame的,但我坚持表面。我无法画出表面或其他东西。 这里是我的代码:pygame的表面不显示
import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
#surface = pygame.Surface((100, 100))
done = False
screen.fill((255, 255, 255))
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
#surface = pygame.Surface((50, 50))
surface = pygame.Surface((100, 100))
#surface.fill((255, 0, 0))
#surface.set_colorkey((255, 0, 0))
pygame.draw.circle(surface, (0,0,0), (25,25),25)
#pygame.draw.rect(screen, (0, 128, 255), pygame.Rect(30, 30, 60, 60))
pygame.display.flip()
所以,当我想画的东西到屏幕上它吸引它:
这工作:
pygame.draw.circle(screen, (0,0,0), (25,25),25)
但是,这并不:
pygame.draw.circle(surface, (0,0,0), (25,25),25)
我已经阅读了一些文档,但它似乎足以调用表面并将背景白色,因为默认情况下会将其绘制为黑色。我真的不知道我做错了什么。
我希望是足够的信息。
干杯。
您需要将表面“blit”到屏幕上。 –
[这是对曲面的简短介绍。](http://stackoverflow.com/documentation/pygame/7079/drawing-on-the-screen/23787/surfaces#t=201704182035216002602) –
谢谢你们,非常感谢 –