Installing PyGame on a Windows PC
Dec 02, 2020 Command to install pygame on windows based system: pip install pygame There are 7-basic steps to displaying Text on the pygame window: Create a display surface object using display.setmode method of pygame. Create a Font object using fony.Font method of pygame. Create a Text surface object i.e.surface object in which Text is drawn on it. Def closewindow : ' Closes the current window, and then runs garbage collection. The garbage collection is necessary to prevent crashing when opening/closing windows rapidly (usually during unit tests). ' global window window. Close window = None # Have to do a garbage collection or Python will crash # if. 3.6: The QUIT Event and pygame.quit Function, 05, DISPLAYSURF = pygame.display.setmode(( 400, 300 )) Normally it doesn't really matter since Python closes it when the program exits Could someone help me out with closing a pygame window? I'm following along with a book I'm reading and one of the examples involves the module pygame.
This blog will tell you how you can install PyGame on a computer with Windows OS
Oct 23, 2018 By Team YoungWonks
In this blog, we shall look at the procedure to install PyGame on a Windows PC; we also have a blog about installing PyGame on a Mac. Now PyGame is cross-platform set of modules in the Python programming language. These modules are designed for writing video games. Thus PyGame includes computer graphics and sound libraries that have been created to be used with the Python programming language.
Now how do we do install PyGame on a Windows computer? Let us start by looking at how one can install Python on a Windows PC.
The video below tells you how to do so...
Now that we have installed Python on the Windows PC, we can go on to install PyGame.
Installation of PyGame on Windows:
- Start by closing any IDLE or Python window that might be open. This could include the shell or the program itself.
- Click on the Start menu and open IDLE.
- Now click on File at the top and then select Open.
- Then double click on Scripts folder and open it.
- At the top, you’ll see Scripts written; right click on Scripts and select Copy address as text.
- Go to the Start menu again and open Command Prompt by typing cmd.
- Now type cd followed by space and then paste the copied address / location.
- After this, press Enter.
- Now type pip3 install pygame like you see on the screen.
- Wait for the successful installation message and your PyGame installation is done.
- You can test if PyGame has been installed on your Windows OS by typing import pygame in your IDLE.
- If there’s no error, it means PyGame has been successfully installed on your Windows computer.
Pycharm Pygame
This blog is presented to you by YoungWonks. The leading coding program for kids and teens.
YoungWonks offers instructor led one-on-one online classes and in-person classes with 4:1 student teacher ratio.Sign up for a free trial class by filling out the form below: