欢迎光临散文网 会员登陆 & 注册

《 python和pygame游戏开发指南》-(2)界面画图测试

2020-03-23 15:54 作者:一心想当网红的李老师  | 我要投稿



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()


《 python和pygame游戏开发指南》-(2)界面画图测试的评论 (共 条)

分享到微博请遵守国家法律