Questions tagged [pgzero]

pgzero (Pygame Zero) is a Python library providing a zero-boilerplate game development framework. It is based on another third-party library named pygame.

pgzero (Pygame Zero) is a Python library providing a zero-boilerplate game development framework. It is based on the library pygame.

PyPi: https://pypi.org/project/pgzero
Source code: https://github.com/lordmauve/pgzero
Documentation: https://pygame-zero.readthedocs.io

104 questions
6
votes
2 answers

How to make a Pygame Zero window full screen?

I am using the easy-to-use Python library pgzero (which uses pygame internally) for programming games. How can I make the game window full screen? import pgzrun TITLE = "Hello World" WIDTH = 800 HEIGHT = 600 pgzrun.go() Note: I am using the…
R Yoda
  • 8,358
  • 2
  • 50
  • 87
5
votes
1 answer

What alternatives are there to `time.sleep()` and `pygame.time.wait()`?

I'm very new to python. I am working on a simple game. So far, what I am trying to do is to add a few second delay between it showing the question rectangle and then showing the options. How would I do this? I tried using time.sleep or…
5
votes
11 answers

Name 'Actor' is not defined

I have a problem with python programming, when I'm trying to write a game (introduced by the book: Coding Games Python DK 3), it says: name 'Actor' is not defined. here's my code: import pgzrun from random import randint WIDTH = 400 HEIGHT =…
mhm
  • 313
  • 1
  • 5
  • 12
4
votes
3 answers

pygame - moving graphic (Actor)

I'm just making a little game with Pygame. Objects should move across the screen. When I try to do this, a "track" is always dragged along (see picture). How can I move the apple without drawing the "course" of the movement? from random import…
siclaro
  • 137
  • 13
3
votes
1 answer

Pygame_Zero window positioning

I am working with pygamezero using an editor called MU (this has the pgzero module built in). When the code is executed the top left of the game window spawns from the centre of the screen and, depending on the dimensions provided by the user for…
3
votes
2 answers

Pygame Zero: TypeError: cannot create weak reference to 'NoneType' object

Hello so I am currently programming a little 2D game. I already have movement etc. figured out. Now I want to add a simple animation by using something I found on here: def anim_right(): global counter_right imagesright =…
Ignitris
  • 55
  • 5
3
votes
1 answer

How can I run a Pygame Zero program from the Command Prompt?

I can run Pygame Zero programs from idle if I add the necessary code. but when I try to run it from the command line no matter what file or folder I try to put my Pygame zero project in, it will not open a window it only says Pygame 1.9.5. Then, the…
Tlang55
  • 31
  • 2
3
votes
3 answers

Repeated key detection in PyGame Zero

My pgzero key press event handler does recognize a pressed key only once (until released) but does not support repeated key press events if the key is kept pressed. How can I achieve this? PS: Since pgzero is implemented using pygame perhaps a…
R Yoda
  • 8,358
  • 2
  • 50
  • 87
2
votes
1 answer

Resizing a sprite with Pygame Zero

I am making a space invaders game using pgzrun and I am trying to resize a sprite I have. I tried to research how to do it and I was not able to find a command. There is a command that does it in pygame but I was wondering if there is one for pygame…
2
votes
1 answer

I wrote a line to display hello in pygamezero but instead its showing white blocks instead of texts

i executed the following code def draw(): screen.draw.text("hello", topleft=(10 , 10)) but the output I get is just 5 white blocks instead of hello enter image description here
Tathagat
  • 23
  • 3
2
votes
1 answer

Calling another pygame-zero program from a main pygame-zero window

I want to create multiple small games in pygame zero, with a main window on which you have buttons to click - when clicking a button it would start a new window and a new subgame (coded on its own in another file). The secondary games should be able…
ka1rn
  • 21
  • 1
2
votes
1 answer

How can I check collisions between actors in pygame using "actor.collidepoint(pos)"

I'm very new to pygame and am trying to make a game where the actor try's to hit the gem, but I cant figure out how to use the "actor.collidepoint(pos)" function for that! Answers are greatly appreciated!
2
votes
1 answer

The draw() function in my quiz game is not working properly

Ok, so I'm making a quiz game using python. I have it so that when your mouse hovers over one of the options, it changes color. However, there are two problems that are occurring when I try to do it. Only answer_box4 actually somewhat changes the…
2
votes
2 answers

Is clock.schedule_interval() valid in pygame or only pygame zero?

I'm following a tutorial that involves pygame zero and adapting it to create a pygame program, but am haing issues with my timer. The time_left variable is set to 10 earlier, here is the rest of the code to do with the timer: def…
LWeaver
  • 45
  • 4
2
votes
1 answer

Can't remove instances of a class

I starting to code in python and using pyzero to make a simple game. After the end of the game, I want to delete all the existing instances of certain types of classes, to allow the game to start again. I have a list of all the instances of that…
RD210
  • 23
  • 2
1
2 3 4 5 6 7