How to install and set Pygame on vscode by PukaTech

Published: 24 December 2022
on channel: PukaTech
49,489
627

Hello there, In this video I will show you how to install and set up vscode and python for a pygame step by step.

#vscode #python3.11 #python #pygame #python3 ‪@pukatech‬
Links:
Python link: https://www.python.org/

Visual Studio Code link: https://code.visualstudio.com/download

Pygame library link: https://www.lfd.uci.edu/~gohlke/pytho...

Press ctrl + f and type “Pygame:”

Commands for installing the pygame library:

1. Navigate to where you downloaded the pygame library in vscode terminal:
cd C:\Users\your-username\Downloads

2. type: ls

3. copy the file(pygame library you downloaded) name

4. type: python -m pip install ./paste the file name here without spaces

5. sample code to test (make sure to remove the quotation marks around the code) :
"
import pygame

pygame.init()

white = (255, 255, 255)
black = (0, 0, 0)
red = (255, 0, 0)

dis = pygame.display.set_mode((800, 600))
pygame.display.set_caption('Snake Game')

game_over = False

x1 = 300
y1 = 300

x1_change = 0
y1_change = 0

clock = pygame.time.Clock()

while not game_over:
for event in pygame.event.get():
if event.type == pygame.QUIT:
game_over = True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
x1_change = -10
y1_change = 0
elif event.key == pygame.K_RIGHT:
x1_change = 10
y1_change = 0
elif event.key == pygame.K_UP:
y1_change = -10
x1_change = 0
elif event.key == pygame.K_DOWN:
y1_change = 10
x1_change = 0

x1 += x1_change
y1 += y1_change
dis.fill(white)
pygame.draw.rect(dis, black, [x1, y1, 10, 10])

pygame.display.update()

clock.tick(30)

pygame.quit()
quit()
"



python,pygame,how to install pygame,pygame tutorial,python tutorial,pygame tutorial python 3,vscode python setup,how to set up python,how to install pygame for python,how to install pygame on mac,how to install python on windows 10,python pygame tutorial,python pygame,how to setup python for vscode,install pygame,install python,how to build a game in python,vscode python,pygame how to install,python with vscode,python vscode setup windows,vscode, pygame,install pygame,how to install pygame,pip install pygame,how to install pygame on mac,pygame on windows,pygame on windows 10,how to install pygame 2023,how to install pygame in python,how to install pygame for python,how to install pygame using pip,how to install pygame in pycharm,how to install pygame in python 3.10​,how to install pygame for python 3.11,how to install pygame in python windows 10,how to install pygame in visual studio


Watch video How to install and set Pygame on vscode by PukaTech online without registration, duration hours minute second in high quality. This video was added by user PukaTech 24 December 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 49,48 once and liked it 62 people.