-
-
Save JeffersGlass/5b9790e08452e86aa9a2f223a45665de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import sys #will use the exit function | |
#Loads all the main pygame modules and initializes them | |
pygame.init() | |
screen_width=640 | |
screen_height=480 | |
blue = (0,0,255) | |
white = (255,255,255) | |
#Create a new Surface with the dimensions listed above | |
screen=pygame.display.set_mode((screen_width, screen_height)) | |
#Use this code to find all the fonts on your system, if necessary: | |
#for f in pygame.font.get_fonts(): | |
# print(f) | |
myFont = pygame.font.SysFont('freemono.ttf', 48) | |
#Loop forever: | |
while True: | |
#The following makes the window close when clicking the "X" or exit button | |
#Without this, the window will not close, and will need to be killed | |
#with the task manager | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: sys.exit() | |
#render takes a string, Anti-alias? (T/F), color) | |
helloText = myFont.render('HELLO, WORLD', True, (255,255,255)) | |
#Put the text on the screen: | |
screen.blit(helloText, (320,240)) | |
#Output new changes to the screen | |
pygame.display.flip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment