Pycharm中安裝Pygame並寫第一個程序


第一步:打開Pycharm

第二步:點File ->Default Settings->Project Interpreter->點加號

第三步: 搜索Pygame->Install Package

 

然后就安裝好了,新建一個project試試吧。

 

import pygame, sys
from pygame.locals import *

white = 255,255,255
black = 0,0,0

pygame.init()

screen = pygame.display.set_mode((600, 500))
myfront = pygame.font.Font(None,60)
textImage = myfront.render("aefafaefwfawef", True, black)

while True:
for event in pygame.event.get():
if event.type in (QUIT, KEYDOWN):
sys.exit()
screen.fill(white)
screen.blit(textImage, (100, 100))
pygame.display.update()

 

 

 

 

 

 

 

 

 


免責聲明!

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



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