首页 > 编程语言 > 详细

第一个Python游戏窗口

时间:2018-06-14 00:32:34      阅读:236      评论:0      收藏:0      [点我收藏+]

不废话,撸起袖子就是干。

import pygame
import sys
pygame.init();
caption=pygame.display.set_caption("Python App");
screen=pygame.display.set_mode([640, 480]);
obj = pygame.image.load("avatar.png").convert_alpha();
isQuit=False;
while not isQuit:
 for event in pygame.event.get():
  if event.type == pygame.QUIT:
   isQuit=True;
  screen.blit(obj, [100, 10]);
  pygame.draw.rect(screen, [255,0,0], [150,10,20,40], 0);
  pygame.draw.circle(screen, [0,0,0], [20, 50], 200, 10);
  
  pygame.display.update()
  screen.fill([255, 255, 255])
pygame.quit();
sys.exit();

 

第一个Python游戏窗口

原文:https://www.cnblogs.com/swordenchanter/p/9180618.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!