Add Pygame (#1247)

* Create Pygame.py

* Update readme.md

* Update Pygame.py

Co-authored-by: MrBrain295 <66077254+MrBrain295@users.noreply.github.com>
This commit is contained in:
calgary34
2022-01-21 17:00:58 -07:00
committed by GitHub
parent 636ffc3190
commit 32ef2ecbae
2 changed files with 19 additions and 0 deletions

18
p/Pygame.py Normal file
View File

@@ -0,0 +1,18 @@
import pygame, sys
from pygame.locals import QUIT
pygame.init()
display_surface = pygame.display.set_mode((400, 300))
font = pygame.font.Font(pygame.font.get_default_font(), 32)
text = font.render('Hello World', True, (0, 0, 0))
textRect = text.get_rect()
while True:
display_surface.fill((255, 255, 255))
display_surface.blit(text, textRect)
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update()

View File

@@ -669,6 +669,7 @@ Make sure to see [contributing.md](/contributing.md) for instructions on contrib
* [Pure Data](p/Pure%20Data.pd) * [Pure Data](p/Pure%20Data.pd)
* [PureBasic](p/PureBasic.pb) * [PureBasic](p/PureBasic.pb)
* [PureScript](p/PureScript.purs) * [PureScript](p/PureScript.purs)
* [Pygame](p/Pygame.py)
* [PyQt4](p/PyQt4.py) * [PyQt4](p/PyQt4.py)
* [PyQt5](p/PyQt5.py) * [PyQt5](p/PyQt5.py)
* [Pyret](p/Pyret.arr) * [Pyret](p/Pyret.arr)