《 python和pygame游戲開發(fā)指南》-(2)界面畫圖測試
2020-03-23 15:54 作者:一心想當(dāng)網(wǎng)紅的李老師 | 我要投稿
import sys
import pygame
from pygame.locals import *
pygame.init()
Win=pygame.display.set_mode((720,480))
pygame.display.set_caption('first try')
White=(255,255,255)
Green=(0,255,0)
pygame.draw.line(Win, White, (50,50),(300,300),4)
pygame.draw.line(Win, Green, (100,50),(200,300),1)
pixObj=pygame.PixelArray(Win)
pixObj[200][200]=White
pixObj[300][300]=White
pixObj[400][400]=White
pixObj[100][200]=White
del pixObj
while True:
? ? for event in pygame.event.get():
? ? ? ? if event.type==QUIT:
? ? ? ? ? ? pygame.quit()
? ? ? ? ? ? sys.exit()
? ? pygame.display.update()
標(biāo)簽: