From 32ef2ecbae5e5d7eba2c97b7a7a495a2a98eddbd Mon Sep 17 00:00:00 2001 From: calgary34 <51468959+calgary34@users.noreply.github.com> Date: Fri, 21 Jan 2022 17:00:58 -0700 Subject: [PATCH] Add Pygame (#1247) * Create Pygame.py * Update readme.md * Update Pygame.py Co-authored-by: MrBrain295 <66077254+MrBrain295@users.noreply.github.com> --- p/Pygame.py | 18 ++++++++++++++++++ readme.md | 1 + 2 files changed, 19 insertions(+) create mode 100644 p/Pygame.py diff --git a/p/Pygame.py b/p/Pygame.py new file mode 100644 index 00000000..44706ff1 --- /dev/null +++ b/p/Pygame.py @@ -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() diff --git a/readme.md b/readme.md index e648f8ff..076dc537 100644 --- a/readme.md +++ b/readme.md @@ -669,6 +669,7 @@ Make sure to see [contributing.md](/contributing.md) for instructions on contrib * [Pure Data](p/Pure%20Data.pd) * [PureBasic](p/PureBasic.pb) * [PureScript](p/PureScript.purs) +* [Pygame](p/Pygame.py) * [PyQt4](p/PyQt4.py) * [PyQt5](p/PyQt5.py) * [Pyret](p/Pyret.arr)