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

I'm trying to figure out what is my problem with moving playerX to the screen? I want to move playerX += .1 but i'm getting error?

import pygame #intialize the pygame pygame.init() # create the screen screen = pygame.display.set_mode((800,600)) # Title and Icon pygame.display.set_caption("Space Invader") icon = pygame.image.load('spaceship…
0
votes
1 answer

Pygame "'set_at' for 'pygame.Surface' objects doesn't apply to 'tuple' object"

I am coding a basic program that reads data from a file where each character represents a pixel's color and then displays that info on the screen using pygame. I've got a block of code that reads the file which works beautifully, but when I try to…
0
votes
0 answers

how to make a sprite draw on the screen like the turtle library

I have the draw function and the sprite ready and I'm trying to comebine them so it would be a turtle drawing on a white screen. Sorry for the long code I'm still new too python and learning me and my friend Nathan wrote this. both codes work I'm…
Sinfro
  • 23
  • 4
0
votes
0 answers

“TypeError: 'pygame.Surface' object is not iterable” while trying to create package

I am trying to package my app using py2app, but I encounter this error each time when I enter the command into terminal: TypeError: 'pygame.Surface' object is not iterable This is the command I entered to package the app: python setup.py py2app I…
Normy Haddad
  • 181
  • 9
0
votes
1 answer

Why do my player images "streak" when they go outside the court on my screen?

My players move fine until they move outside they court, until the images streak. Why is this? I tried changing screen.fill(OUT) to drawing a rectangle the size of the screen. import pygame import time pygame.init() # Define some colors BLACK =…
Robert Smith
  • 673
  • 10
  • 25
0
votes
1 answer

Python Pygame text overlay printing on top of itself each time

I'm currently wanting to use an old piece of Python code called python slideshow with time and weather (github). I'm using a Raspberry Pi and I've got it all setup and it works perfectly in landscape (normal) mode. This is a slideshow application…
user1721451
  • 247
  • 6
  • 15
0
votes
1 answer

PyGame blit image disappears when no mouse event is fired?

When using surface.blit during a mouse event, the blit doesn't remain on the screen. I have two almost identical images. The standard image already exists on the surface and when the mouse hovers over the image, another image needs to be placed on…
nx_prv
  • 127
  • 8
0
votes
2 answers

Pygame ; Problem with Alpha gestion on Surface

Hii I need help about pygame I'm under python 3.7.2 64 bits So I'm bassically working about a smooth way to exit a window I thought to create a fade out animation by using pygame.SRCALPHA on a surface Let me introduce the problem : it's isn't work…
user10620375
0
votes
1 answer

pygame surface rotating in a nonsensical way

I'm trying to build a simple game and so far I'm just learning the basics. I'm trying to draw a rectangle tilted 45°, but I couldn't figure how to keep it centered even after reading some previous question here on SO. So I tried making a rectangle…
dbac
  • 328
  • 1
  • 10
0
votes
1 answer

TypeError: argument 1 must be pygame.Surface, not tuple

I am new user of Stack Overflow, and my problem is if I run the code it will give me the error, the error says: DISPLAYSURF.blit((catImg, dogImg), (catx, caty, dogx, dogy)) TypeError: argument 1 must be pygame.Surface, not tuple how do I fix this…
0
votes
1 answer

pyagme screen not working with multithreading

I am using python 2.7.14 and am currently trying to draw to 2 sides of a pygame screen simultaneously using the multiproccesing module(2 threads are calling functions from a single pygame screen) but everytime I call a function from screen(like…
0
votes
2 answers

Why do i get an error when switching windows?

I tried to build a simple game in python using pygame. At first my problem was to make the movement more smooth, because about every second the movement of the rectangles stuck for a few milliseconds. Then I found an solution by adding…
Luap555
  • 51
  • 1
  • 1
  • 4
0
votes
2 answers

How to fade in a text or an image with PyGame

Can someone help me on this ? : I try to make a title that appear smoothly on the user screen : def image(name,x,y,u): screen.blit(name,(x,y)) if u = 1 pygame.display.update() Window == 'main' While windows = 'main': …
user10620375
0
votes
1 answer

Performance between flip and update in pygame

I am making a game and at this moment I am using the groups to render the stuff, however for simplicity and easier improvements in the future, I will be rendering this sprites manually. So, what is more performant, using flip, one update or update…
Simple coder
  • 151
  • 1
  • 11
0
votes
1 answer

my text won't blit to my display in pygame

i am trying to make a score in the top left corner of my screen but it is returning an error. i have searched it up online and followed the exact steps but still it returns an error. def score(rounds): font = pygame.font.SysFont(None, 25) …
BOBTHEBUILDER
  • 345
  • 1
  • 4
  • 20