import sys
import pygame
from pygame.locals import QUIT
def main():
pygame.init()
surface=pygame.display.set_mode((300,400))
pygame.display.set_caption("Pygame draw")
clock=pygame.time.Clock()
while True:
for event in pygame.event.get():
if event.type == QUIT():
pygame.quit()
sys.exit()
surface.fill((255,255,255))
pygame.draw.rect(surface,(255,255,0),(50,10,80,40),5)
pygame.draw.rect(surface,(0,255,255),(150,10,80,40))
pygame.draw.circle(surface(255,0,255),(100,100),20,5) pygame.draw.circle(surface,(100,100,100),(50,150,80,40),5) pygame.draw.circle(surface,(255,0,255),(200,100),10) pygame.draw.line(surface<(0,100,200),(80,220),200,340,3) pygame.display.update() clock.tick(10)
main()
上記のコードを実行したのですが画面が一瞬出てくるだけですぐにプログラムが終了してしまいます。なぜでしょうか?
回答1件
あなたの回答
tips
プレビュー