第一個Python游戲窗口


不廢話,擼起袖子就是干。

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM