Python / Pygame Tutorial 3 - Creating a Window

preview_player
Показать описание
The next tutorial in my series of videos about Python and Pygame. In this video you will learn about how to create a window, where we will run our games in. If this helped you, please give it a like. Subscribe for more videos!

Download this code:

Code:

import pygame

black = (0,0,0)

gameLoop=True
while gameLoop:

gameLoop=False

Рекомендации по теме
Комментарии
Автор

im from brasil your video helped me open my first window, thanks!!!

andersonrodrigo
Автор

Hey dude! I've used PyGame before, but I never found a good comprehensive guide on it and only learned a little bit! This video was so easy to follow along with!! I wish this existed back in 2010 when I was going to make games in Python. But yeah, defiantly subscribing! Great video and I hope you continue to make more programming videos! You teach Python(in 20 minutes, I may add!!) and then go on to teach PyGame. You, sir, should be proud! :D

sonickk
Автор

wtf. I clicked on your channel after watching this to find the next video - suddenly you were an adult. Turns out this is 5 years old.

ProjectWander
Автор

loved just loved that.. thank you so mutch.. it helped me a lot..
i'm from Brazil!! thanks!!! <3

JOSEJOAOMARIO
Автор

The pygame.event.get() part is where all the events that are happening at the moment are recorded. E.g. if the user presses a key on the keyboard, it gets recorded in that. So we loop through all the events and work out if there is an event with the keyboard. If there is, we do some code. I hope this helps you understand a bit better.

Animations
Автор

If you have Python 3.2.3 installed, reinstall pygame. Uninstall any versions of pygame you may already have and then just download the pygame for 3.2.3 python from the website. In the installation process, make sure you select the python 3.2.3 directory. Hopefully that should work.

Animations
Автор

I check everything. I fond out I have 2 diffident ver of python installed at the same time. so I uninstalled them and just left that 3.2.3 installed. know when I import python I get this error.
ImportError: No module named 'pygame'

kevindadcaly
Автор

hi i get this error quite allot saying santx error i copied the code in the description and it was the same i have this allot do u no why ?

mattebomtastic
Автор

I did everything you said to do. then I get this error when I imported pygame.
NameError: name 'pygame' is not defined.

how do I fix this problem please let me know.

kevindadcaly
Автор

Write everything exactly as I do in the video. If you don't put the code for finding out if the close button has been pressed, the window will freeze. Hope this helps.

Animations
Автор

Didn't realize how much indenting mattered but I was getting the error of video system not initialized until I made sure the pygame.quit() method was lined up with the while like in the vid instead of If statement as I had it.

YusefRhymer
Автор

That's good that it's working now. If you need anymore help, just ask!

Animations
Автор

Just so you know you don't have to write you loop like: game_loop = True, while game_loop. You can just do while True. It is nothing big but it saves line space

CosmicAstroDuck
Автор

I got the window to come up. put it just freeze's and does not responed

kevindadcaly
Автор

Do you know how to open screen in maximised mode by default? That is from the program itself.

harshdobariya
Автор

Make sure you have installed Pygame correctly. You can download and install it from pygame.org

Animations
Автор

loops are basically "repeat until" with scratch

gamerrevocam
Автор

I had the same problem. You have to make sure that you capitalize the QUIT (exactly as she did it)

Exploration
Автор

I had to fix two errors. Can you do a video on finding bugs in python?

superpositiveable
Автор

which version of python are you using, I think that may be the problem with myself

noiedwavve