怎樣使用python游戲開(kāi)發(fā)模塊—pygame

這篇文章主要介紹怎樣使用python游戲開(kāi)發(fā)模塊—pygame,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

創(chuàng)新互聯(lián)公司10多年成都企業(yè)網(wǎng)站建設(shè)服務(wù);為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁(yè)設(shè)計(jì)及高端網(wǎng)站定制服務(wù),成都企業(yè)網(wǎng)站建設(shè)及推廣,對(duì)成都垃圾桶等多個(gè)領(lǐng)域擁有多年的網(wǎng)站設(shè)計(jì)經(jīng)驗(yàn)的網(wǎng)站建設(shè)公司。

安裝Pygame:

pip install pygame
C:\Users> pip install pygame                

Collecting pygame                   

  Downloading 
https://files.pythonhosted.org/packages/3e/f5/feabd88a2856ec86166a897b62bfad828bfe7a94a27cbd7ebf07fd

70399/pygame-1.9.4-cp37-cp37m-win_amd64.whl (4.2MB)

    100% |██████████████████████████| 4.2MB 6.6MB/s

Installing collected packages: pygam

Successfully installed pygame-1.9.4

Pygame使用示例:

import pygame
import sys
pygame.init()  # 初始化pygame
size = width, height = 320, 240  # 設(shè)置窗口大小
screen = pygame.display.set_mode(size)  # 顯示窗口
while True:  # 死循環(huán)確保窗口一直顯示
    for event in pygame.event.get():  # 遍歷所有事件
        if event.type == pygame.QUIT:  # 如果單擊關(guān)閉窗口,則退出
            sys.exit()
pygame.quit()  # 退出pygame

以上是“怎樣使用python游戲開(kāi)發(fā)模塊—pygame”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

分享標(biāo)題:怎樣使用python游戲開(kāi)發(fā)模塊—pygame
文章路徑:http://muchs.cn/article48/iiddhp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、定制網(wǎng)站域名注冊(cè)、面包屑導(dǎo)航、網(wǎng)站排名

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)