Added: 2 years ago
From: thenewboston
Views: 45,188
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (310)

Sign In or Sign Up now to post a comment!
  • fixed it. Thank you.

  • I have done everything as you said. My code is fine, but when I run the code it starts a black windows and then says programe is not responding. By the way I have windows 7.

  • I downloaded the program, the newest version, and I can't find where to open the app, any help?

  • @Vryonette u mean pygame? u dont open it u just use python idle and import it

  • @Vryonette Every browser has a default location to download files. Try c:\users\USERNAME\downloads

  • how can i run the program?

  • Comment removed

  • For everyone experiencing a "couldn't open ___.jpg" error, here are some possible solutions:

    Make sure that the image is actually a JPG

    Make sure you have the name correct and in the correct case.

    Make sure that the JPG file is INSIDE of your Python folder.

    Hope this helps.

  • lol, I made almost exact pictures in gimp. Thanks for these tutorials Bucky. Everything works perfectly.

  • keep geting this error

    TypeError: 'pygame.Surface' object is not callable

  • @oxynecrophobia make sure when you blit you remember your comma after each parameter "screen.blit(mouse_c,(x,y))" VS "screen.blit(mouse_c(x,y))"

  • how do i run the program?

  • can someone please help me?, when i try to run it, it keeps saying on shell "error:couldnt open bg.jpg" any help????????????

  • @Geordan271 It is because you don't have the file called "bg.jpg". This is your programs background, make it in paint or something for now. It must be in the same folder as your program and you need to name it "bg.jpg". Or if you look at the code, you can change what it is named through that in order to use whatever file you want as a background.

  • when i run the program, the pygame window doesnt respond... can someone help me??

  • @ajr4265979 does it say on python shell that you cant find the jpg image? because thats happening to me :(

  • your smart bro.. lol

  • my IDLE closes as soon as i run this, wtf is wrong?

  • it says it coldnt load bif how do i fix it

  • @jdude61 hey, just replying to uou because ihave the same problem. and i was wondering if you got it fixed?

  • When I try to run it, I get an error in line 4 saying: import pygame, sys

    ImportError: No module named pygame

    Help would be much appreciated.

  • @Prototype9511 did you find the anwser?

  • it says pygame.display.update() is invalid syntax, at pygame

  • @14koder try pygame.display.flip()

    it does the same thing

  • cant get it to work I get this error

    TypeError: 'pygame.Surface' object is not callable

  • In case anybody is interested, you can put the following line in your while loop to make the cursor inside the ball disappear:

    pygame.mouse.set_visible(0)

  • how do you run it? when i click run and go run module it come up with a "Python shell" and says import error no module named pygame. can anyone help please

  • @juve1010101 this happens to me too idk what it is il try looking for it

  • Blit , blit meaning , definition of blit , meaning of blit -

    /blit/ vt. 1. [common] To copy a large array of bits from, one part of a computer's memory to another part, particularly when, the memory is being used to determine what is shown on a display, screen.

  • Comment removed

  • Comment removed

  • I put both files in the same location that my program is but doesn't work!!

  • it says that pygame is an invalid syntax!?

  • Blit = BLock Image Transfer

  • So for some reason I can't get my background image to load it can you help me?

  • ok nvm i solved it xD

    turns out i typed geet instead of get in

    for event in pygame.event.get():

  • i did everything right even deleted the whole thing and made it again

    i get the same problem

    when i run the pygame window is black and theres no sprites no background no nothing

    and when i click anything it goes "not responding"

    plz help

    i have windows 7 and pygame 2.5 and pythong 2.5.4

    i need help ASAP!

  • Comment removed

  • @XxDahamonnahxX same with me

    the files have to be in the same directory, although that doesn't seem to work for me

  • @TheSdcoolio i got it working i noticed that i typed "geet" instead of "get"

  • @XxDahamonnahxX

    Same here dude. Idk whats wrong. :\

  • get position is it

  • thanks but its the line b4 that it is screen.blit( backround, (0,0) ) *it says the error is rite here*

    x,y = pygame.mouse.get_pos()

  • can some1 help me

    rite where this vidoe start that line of code it says unindent does not match any outer identation level

  • @jjobros

    maybe u made one space indentation;

    it's not obvious sometimes, so make sure u check the indentation is similar errors occur

  • now if only somebody could help me make the cursor arrow disappear

  • @QuentinWatt pygame.mouse.set_visible(0)

    

  • It says it cant load my background...

  • I am getting an error message saying that I have no available video device. I have no idea what this means

  • Please help me. I did all the steps but all it is, is a big black screen. Is there a probem in my code? please help. I have a 64 bit computer. and my backround image was 5000x3500. Was that too big?

  • i'm using python 3.1 and everything works except the edges on my mouse aren't transparent. Does anyone know how to fix this?

  • @ItsaUFOduh you have to have a transparent image to start with.. If you have GIMP(photo editor), you can make an image transparent like I did, and also resize it to like 60x60 which worked like a charm for me

  • I get an error screen=pygame.display.set_mode­((640,360),0,32)

    error: No available video device, not sure whats wrong :(

  • @whatsajaymo maybe try changing the screen command to: screen=pygame.display.set_mode­­((640,360),0,24)

    or if that doesn't work try this: screen=pygame.display.set_mode­­((640,360),0,16)

    and if that fails as well than go through your code again character by character from the start all the way to the end and just keep on trying until you'll finally get it ;)

  • @Kamilk12l thanks so much, the first one I tried worked. :)

  • @whatsajaymo I'm glad I helped ;)

  • @whatsajaymo Im getting the same error and have no idea whats wrong with it

  • whenever i try to run the program pygame stops responding, any ideas why ?

  • @Tauronos are there any error messages displayed in IDLE ? Post them here so we can try figuring it out ;)

  • It wont find the background picture...even if its in the exact same file as the other programs....this is very discouraging.

  • @trevonturner double-check the name of your pictures and the format extensions they have. Small things like that can be really annoying. And maybe try making a new folder on your desktop and throw everything in there. The worst part in programming is when you get an error but the best part is when you solve it ;)

  • whenever i try to run my program my pygame window turns white so I tried reducing the size but it still won't work

  • So is it normal that even though the program works fine, I get an error in the shell when I quit?

  • @bleachfan44 Are you exiting the program before the shell? You have to exit pygame first, or it will ask you if you wish to kill the program.

  • awesome, but im having problems with the QUIT part of the code any ideas?

  • When I think of POS, I automatically conclude it means Primary Operating System. I need to go outside more...

  • I need help making the boundaries for my game! can anyone help?

  • Whenever I try and install the newest Pygame it says I need Python version 2.4 or something. I have 2.7 on my computer, and pygame is already installed. Python says there's no pygame module.

  • @TheMarioMan1 you have to download the pygame for 2.7 that is your version. i first encounter the same problem, because i download the wrong version, what you have to do is looking for file named this: "pygame-1.9.2a0.win32-py2.7.ms­i", sized 6.4 MB. You can see the syntax -py2.7.msi which refers to your python version

    hope this help

  • @1chapper I get an error saying it can't open the background. It's called bg.jpeg, and I can't save it as jpg. Could that have anything to do with it? Does it need to be saved as a jpg? Please respond.

  • @IsisNiko

    You could use set the variable as:

    bif="bg.jpeg"

    instead of .jpg.. it should work that way ;)

  • screen.blit(background, (0,0))

    i keep getting an error on this line!

    "unindent does not match any outer indention level"

  • convert_alpha() did not work for me at all

  • @Flargleful You can use Photoshop to create your own ball image, or you can search on google for a .png image

  • when i try to run it, it says pygame not responding and then it says unable to open bg.jpg. HELP!

  • I've used to code by Basics and C++, I got shocked when I saw that in python there's no damn if...end if sections at all. That all seems very confusing... But when you've learned indenting code it's pretty easy.

  • "In the corner of the ball" i did not know that balls had corners xD

  • convert_alpha() didnt do anything my ball.png, you see the ball and the box i made it in it isnt transparent? why?

  • my mouse isnt in the middle -_-

  • it says no module named pygame... but ive installed pygame 4 times now

  • @asfadasfa1234 Mine has the same error.

  • @asfadasfa1234 Make sure that it is compatible with your version of Python. If you have Python 2.7, then download and install the version of Pygame that has 2.7 at the end of it.

  • @asfadasfa1234 If ImTheBatchMan's suggestion didn't help, make sure you installed it in the same directory as python.

  • mine just crashes...

    TypeError: 'pygame.Surface' object is not callable

  • @ben1996123 I got that error once but from the information it displayed on the terminal, I figured out that I made a typo for the screen.blit for the mouse. What I did "screen.blit(mouseImage (x,y))" What your supposed to do "screen.blit(mouseImage, (x,y))".

  • in order for it to load, the file has to be in the python directory. if not give bif or mif the image file location first example: mif="c:\.....\.....\......"

    this is the file location. then you can load it by doing the following:

    mouse_c=pygame.image.load(mif)­.convert_alpha()

  • @1chapper

    I finaly fixed that frggin bg, but now the ball/cursor wont load! Help?

  • About the not being able to load image problem..... Make sure the dimensions of the pic u entered were correct (example: (640,300)

  • For the images to work, you need to put the pictures in the directory that your save file is in. For example I named this "simple program" which is located in C:\Python26\Programs for me. So, I put both image files in the same location and it worked like a charm.

    Thumbs up since this is a common problem and reply to this post if it still does not work

  • @1chapper ive done what youve said but every time i attempt to run module it keeps coming up with "There's an error in your program:

    expected an indented block"

    it then highlights pygame in pygame.quit() section of my code

    any idea how to fix this?

    i'm on 2.7

  • @1chapper I created a folder and i saved it in my own directory called Programs and have the 2 pictures The Background picture is bg.jpeg and Player is ball.png. I had the save file on there and run it and had no sprites still D:

  • i copied it exactly and wen i click run it says

    background=pygame.image.load(b­if).convert()

    error: Couldn't open bg.jpg

    and then the pygame window doesnt even start because it freezes and says not responding

    some1 help please:(

  • @migitman195 Same problem with me.. :/

  • @SlipAllCityToy dude u must have a file with that name,i ts not only copying.Go to google find a file save it as ''bucky.jpg'' then bif=bucky.jpg

    background=pygame.image.load(b­if).convert()

  • @migitman195 same thing happened to me

  • When ever I start the window it is always black

    Can anyone help?

  • Guy's i know how to get it to work!(the pic's) What you do is just put full details so like of me in was. For bg.jpg: C:\Users\Toby\Desktop\Python 2.6/bg.jpg. For the ball is was: C:\Users\Toby\Desktop\Python 2.6/ball.png. On windows 7 just click the arrow and is will change copy it and paste it in where is says: bif= or for the ball mif=. Hope this helped! RATE UP TO KEEP IT ALIVE!

  • 5:40 I think blit may be a play on letters of the C function BitBlt from windows api

  • @74SteveG my bad 5:11 my timing was off

  • what does pos stand for?

  • @PurexOvvnage Possy???

  • @PurexOvvnage Position

  • @PurexOvvnage position

  • ...why wont my bg.jpg load?

  • @nick114245 same :(

  • PICS WONT WORK!!!!! i was so excited to make a program to!

  • Images didn't work for me....  :(

  • @HighTechPanda same... how do u get it to work!!, wait probably shouldn't be asking you...

  • does this all work for mac?

  • The edges of my ball isnt transparent, any help please?

  • @VietHuynhMate you have to make it transparent in gimp or something, so like layer, transparency, add or alpha or whatever it is. loop up crosshair tutorial or something that needs transperancy if you don't understand :)

  • @OCoptimusconvoy Thanks a lot!

  • @VietHuynhMate no prob!

  • @VietHuynhMate remember to put convert_alpha or aelse it won't work

  • If you are wondering why he uses a "-=" when placing the cursor, here is an explanation of how -= works: lets say you have a statement that says "x -= y"... this can be re-written mathematically as "x = x - y"... or can be understood as "change the value of x by subtracting y from it"... he does the formula in his program to subtract half of the total hight (and width) from the actual cursor location (bottom right of object) to find the center. keep this comment alive if you found it helpful :)

  • @greenguitar28 I have a question. Are you sure the cursor location is bottom right and not top left? Because, when I blitted the image right at x,y, it showed the mouse pointer at the top left of the image. Tad confused now.

  • @greenguitar28 also known as an augmented assignment operator

  • hmm, i like, but this crap of indentation pisses me off. I rather the punctual way since there is less ways of causing errors, and indentations can sometimes decide not to indent to the position they did before.

  • wont open my .jpg...redone this thing like 5 times......

  • it gives me an error and wich say that it couldn't open my bg.jpg

    By the way nice videos!!!

  • it says :unindent does not match any outer indentation level

    can someone help plzzz

  • blit is norwegian for "flash" which might have to do with this.

  • @randomlyunknown2012 nei nå lyger du "Blitz" er flash men blit er vel nereme became

  • @lagemegnorsk I don't actually speak norwegian, I just looked it up, but did you say that blit also means became, or to become?

  • @randomlyunknown2012 It is preteritum for become

  • It can't load my ball and bg images. . . What did I do wrong?

  • @ImTheBatchMan The images have to be in the same folder as your program.

  • @FatalNova they are

  • @ImTheBatchMan You maybe saved the pictures as something else than the program is looking for. If not, then I'd say re-do.

  • I did what you did and it didn't work...

  • I hear only Pie Game xD

  • Awesome! I looked at those lame tutorials which are linked ate pygame.org and they were all incomplete and amateurish. but ur ones are awesome!!! Thanks .

  • Nice man this is really helpfull

  • My computer can't find the images when I use bif="C:\Users\Name\Pictures\im­g.jpg" or when I put them in the same directory and just use bif="img.jpg"

  • BLIT:

    In computing, the Blit was a programmable bitmap graphics terminal designed by Rob Pike and Bart Locanthi Jr of Bell Labs in 1982.

    Bit BLIT (which stands for bit-block [image] transfer but is pronounced bit blit) is a computer graphics operation in which several bitmaps are combined into one using a raster operator.

    Here it is is this good eanugh?

  • XD, it kept not working because of one stupid error.

    It's always something stupid...always...

    =Math

  • How to make your edges transparent? Please heeeelp!!!

  • @ajspingvin mouse_c=pygame.image.load([you­r image]) .convert_alpha()

    alpha = transparency in webdesigning, liek here :)

  • @XanthaPrograming Thanks... Okey. Dont know what to say anymore. Okey. Yay?

  • @ajspingvin worked? :D

  • @XanthaPrograming AAAAAAAAAAAAAAAAAAAAAAAARRRRRR­RRRRRRRRRRRRRGGGGGGGGGGGGGGGGG­GGGGGGGGGGGHHHHHHHHHHHHHHHHHHH­HHHHHHHHHHHHHHHHHHHHHHHHHHHHH!­!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!­!!!!!!!!!!!!!!!!!!!!!!!!!!!

    YES!!! NOW I GOTTA GO POO! PEOPLE, I NEED PRIVACY, I NEED TO POO!

  • @ajspingvin äh. ya? ;D

  • @ajspingvin, transparency is a characteristic of the .png or .gif file. I used .gif instead of .png because Irfanview can make them.

    Make a 32x32 .bmp file in Microsoft Paint, with a red circle. Make the circle touch the edges of the 32x32 square on all 4 sides, fill the circle with red, fill each corner with blue. Save as ball.bmp.

    Open ball.bmp in Irfanview. Save As GIF, check "Show options dialog," check "Save transparent color" & choose "Choose transparent color during saving," then Save.

  • @ncdave4life, BTW, if you don't already have Irfanview, then GET IT! It is awesome, and free. What's more, believe it or not, in an age when program sizes are measured in the hundreds of megabytes, the entire Irfanview program folder is less than 2 MB, total. Its Bosnian author, Irfan Skiljan, is an incredible software developer. (Sorry, Mac folks, it's for Windows only.)

    Also BTW, don't worry about the fact that you're using a ball.gif file instead of a ball.png file. Both work fine.

  • @ncdave4life OKEY!!! JUST STOP!!! I asked a question like a month ago and I figured it out and got help with another youtuber. No need to reply more.

  • lol mine kept crashing because i forgot a comma somewhere

  • this is very similar to PSPlua

  • Comment removed

  • make sure you save your game script in the same directory a the pictures. :P

  • Doesnt the "/2" just divide the X and Y axis by 2 so the mouse will be perfectly in the middle of the edges of the image? Apples...

  • it's ok i found the problem was not the code

  • I having a problem in the line screen=pygame.display.set_mode­((640,360),0,32)

    my python program is 2.6 and the pygame is 1.9.1release-svn2575 in 32 bit

    and i having problem with alpha section too.

  • I having problem in the line screen=pygame.display.set_mode­((640,360),0,32) is giving me a error

  • i wanted to know what a good book for a person who is new completely new to game development that could help me learn how to do this and understand all this. is therea good book that starts from scratch

  • I keep getting this:

    @linux03:~$ python pg1.py

    open /dev/sequencer or /dev/snd/seq: No such file or directory

    The second line is the error message that is being thrown to me...

    A window then appears that it totally black, and there is no image at all...

  • nvm i fixed it

  • it gives me a syntax error where i say import pygame but when i tested it out on the python shell gui thingy it worked

  • I did it!! After a two tedious hours of trying to get pygame to work and to find out how I actually open it. I haven't watched your python tutorials yet. I'm planning too, but right now I felt like making games. I have no idea why I am feeling so proud just from something so simple... Perhaps because I've tried "programming" before and never got it, and now I made someting without game maker or anything like that where everythings already done for ya, basically.

  • @Naihatsu92 awwwwwwww. im jusyt like you lol. forget learning the basics i wanna doo the cool stuff now.

  • Anyone who is having problems with locals not importing like I did, make sure your program is named something OTHER than a module, such as pygame (which is what I did) If you name the file pygame.py, it will find that file first and never look for the actual pygame lol.

  • A small reminder: Don't call your file pygame.py and save it in your Python folder. Python will try to import from your own file. I did this xD

  • Comment removed

  • Comment removed

  • i kepp getting pygame.error: Couldn't open pic.jpg

  • @selectguygl

    is the picture in the same folder as the program?

  • when i tried to preview it, it said "error: Couldn't open bg.jpg" please help

  • @randOmazing It either means that the background pic you made isnt in the same folder as your program or that you didnt make the picture

  • @XAutomatedOwnerX the pygame folder or python?

  • @XAutomatedOwnerX THANK YOU SO MUCH!!!

  • why did you put  -= instead of just = ?

  • Comment removed

  • Why do all these tutorials use older version of python >=(

    I tried downloading 2.6.1 and it always gave me a download error. Does anyone have a 3.1 tutorial?