Questions tagged [pygame-surface]

pygame object for representing images. Use this tag only if you are using the pygame library and not if you have a question about programming a game in python in general.

The most important part of pygame is the surface. Just think of a surface as a blank piece of paper. You can do a lot of things with a surface – you can draw lines on it, fill parts of it with color, copy images to and from it, and set or read individual pixel colors on it. A surface can be any size (within reason) and you can have as many of them as you like (again, within reason). One surface is special – the one you create with pygame.display.set_mode(). This ‘display surface’ represents the screen; whatever you do to it will appear on the user’s screen. You can only have one of these – that’s an SDL limitation, not a pygame one.

Home Page: http://www.pygame.org/docs/ref/surface.html

609 questions
0
votes
1 answer

Pygame surface location seems to be different than what it is on the screen?

I am trying to make a virtual phone kind of program with pygame, just to experiment with it, but i ran into a problem. I have loaded an image and then blitted it to the bottom left of the screen. But when i do print(imagename.get_rect()) it prints…
Skelly
  • 109
  • 1
  • 10
0
votes
1 answer

While loop stops at if statement - pygame

Whenever I run this code, it stops right before the screen.blit while still looping, printing the 'debug3' over and over. It doesn't even recognize that the screen is not defined, and my intention is for it to run the screen.blit. ... playermove =…
0
votes
1 answer

PyGame Invalid Position For Blit

I am creating a small level designer in Python (using PyGame). The program is supposed to just let you place down an image, change between images, export to a PNG file, and export image path and coordinates to where it was place in a text document.…
0
votes
2 answers

How to find location of an image that was blit onto screen(python,pygame)

If I blit an image onto the screen how can I find the location of that image on the screen after. I'm using pygame in python
user10274987
0
votes
0 answers

Image Processing With Pi OpenCV

I'm trying to process image on OpenCV Python3. I searched and tried various methods to do the processing. This is far as I could go, I need some help or tips or at least what should i look for. This is what i use line detection for detecting…
0
votes
1 answer

pygame.display.get_surface() as default param in func equals None, but in a func the command returns value

When I put pygame.display.get_surface() as default param in func it gives me None, example: def func(surface = pygame.display.get_surface()): print(surface) And I get None. But if I do this: def func(): …
Python
  • 127
  • 1
  • 14
0
votes
1 answer

error with surf.get_at() pygame

I have a game and I need to know what colour is under the player's feet but when I use surf.get_at_(x, y), it gives me white instead of blue or green. Any help would be appreciated, Thanks!
user9437617
0
votes
1 answer

How to add a specific part of an image in pygame?

I want to load a specific part of an image in pygame. How do I do it? I have an image of a character in different angles. In SDL we use a rect, but do we have this option in pygame?
0
votes
2 answers

how to create an instance of class with two different variable parameters in python?

This code has two classes, it looks like the class Player() have the same code as Block(), I want to minimalize the code, so I don't repeat the spell-like that, and the way to do that is the instances the class, the Player() is an instance of the…
0
votes
0 answers

Pygame collision sides trouble

i am currentely making my final project for my exam and i'm making a platform game. Actually i'm stuck at the collisions because as you know in a platform game i need a different reaction for the upper, right and left side. I'd like to make position…
kevin0304
  • 19
  • 5
0
votes
1 answer

PIL -> PyGame image conversion: Partial data loss

I'm using the C-based screenshot concept from JHolta's answer in Take a screenshot via a python script. [Linux] in order to generate screenshots I'd like to display in PyGame. With some minor tweaks (prepending extern "C" to the functions and…
0
votes
1 answer

Is there still a possibility to blit a video on a PyGame surface?

The pygame.movie package is deprecated and I haven't found an alternative to blit a video on a surface (background for example) and blit other objects on the foreground? That's not possible with moviepy etc. Thank you so much!
Frostie3
  • 11
  • 1
  • 2
0
votes
1 answer

TypeError: pygame.Surface object not callable

I've got this code running at the end of a longer python3 program: pygame.init() size = width, height = 1920, 1080 black = 0, 0, 0 screen = pygame.display.set_mode(size) scoreboard = pygame.image.load("scorebug.png") scoreboardrect =…
0
votes
0 answers

How delete a Rect/Surface with pygame

I need your help I want delete Rect and Surface with pygame but I don't find how I can do this. For example : self.zoneclick_menu_bouton_jouer = pygame.Rect((108, 557), (dim_menu_bouton_jouer)) self.zoneclick_menu_bouton_options =…
LeGensBon
  • 5
  • 4
0
votes
0 answers

Pygame - Problems With Displaying Images With Alpha

I have a title screen loop, that takes the title screen and slowly fades it out. It's copied directly from another program of mine, in which it works like a charm. But it just doesn't work here. It delays correctly, but the image on the screen…