Skip to content
Advertisement

Tag: pygame

PyCharm can’t find reference in PyGame __init__.py?

OK, I’m very new to coding, and I am just learning Python. I figured I would start with some basic Pygame exercises to try to have something to program. I’ve installed Python 3.4.3 and PyCharm. I also installed the Pygame executable “pygame-1.9.2a0-hg_5974ff8dae3c+.win32-py3.4.msi” from here: https://bitbucket.org/pygame/pygame/downloads I ran the Pygame installer, and it seemed to complete without visible issues, though there

pygame.error: video system not initialized

I am getting this error whenever I attempt to execute my pygame code: pygame.error: video system not initialized Answer You haven’t called pygame.init() anywhere. See the basic Intro tutorial, or the specific Import and Initialize tutorial, which explains: Before you can do much with pygame, you will need to initialize it. The most common way to do this is just

PIL and pygame.image

I had opened an image using PIL, as Draw some text on it, as and then saved it as to open it using pygame.image I just want to do it without saving.. Can that be possible? It is taking a lot of time to save and then load(0.12 sec Yes, that is more as I have multiple images which require

Antialiasing shapes in Pygame

I’m using Pygame to draw some things. The problem is that they have a lot of aliased edges: I want to make them softer, like this: My idea so far was to draw the shape in double size, and then use to shrink it to the size I want. Unfortunately if I’m drawing my shapes on a transparent surface, the

How to correctly parse a tiled map in a text file?

I’m making a RPG with Python and pygame for a school project. In order to create the few maps, I have chosen the Tile Mapping techniques I have seen in some tutorials, using a *.txt file. However, I have to cut some sprites (trees, houses, …) into several pieces. The problem is that I’m running out of characters to represent

How to render transparent text with alpha channel in PyGame?

I am using pygame.font.Font.render() to render some text. I’d like the text to be translucent, ie have an alpha value other than 255, so I tried passing a color argument with an alpha value (eg (255, 0, 0, 150)) as the color argument for pygame.font.Font.render() but it didn’t have any effect. I also tried using pygame.Surface.convert_alpha() on the resulting Surface

How to save captured image to disk, using Pygame

This is my code, which starts the webcam : I want to know how to capture an image and store it to the current directory. Please suggest the changes required. Answer When you call webcam.get_image it returns an RGB Surface. So just call pygame.image.save(), the file type is determined by the extension and defaults to TGA. Options are BMP, TGA,

how to play wav file in python?

I tried pygame for playing wav file like this: but It change the voice and I don’t know why! I read this link solutions and can’t solve my problem with playing wave file! for this solution I dont know what should I import? and for this solution /dev/dsp dosen’t exist in new version of linux : and when I tried

How to get keyboard input in pygame?

I am making a game in pygame 1.9.2. It’s a faily simple game in which a ship moves between five columns of bad guys who attack by moving slowly downward. I am attempting to make it so that the ship moves left and right with the left and right arrow keys. Here is my code: It works too well. The

Advertisement