Relative Content

Tag Archive for pythonpygame

zoom and unzoom my screen in a pygame simulation

import sys import pygame import math import dearpygui.dearpygui as dpg pygame.init() # Parameters of the display width = 960 height = 540 angle = 0.0 # Initialize as float speed = 0.0 # Initialize as float x_start = 0.0 y_start = 0.0 gravity = 9.81 # Color HEX red = (255, 0, 0) # Background […]

MouduleNotFound error for a Pygame file being called by a pygame file

The error I am having is as follows: ModuleNotFoundError: No module named 'pygame.rect' I traced the error back to sprite.py(a pygame file) which is trying to import the file rect.py. This is my file path:
File path
The file circled in white is the file trying to import ‘rect.py’. The only similar file I could find was the file ‘rect.pyi’ circled in red.
This is the code trying to import ‘rect.py’: from pygame.rect import rect
I tried changing ‘rect.pyi’ to ‘rect.pyi’ and that created a mess of errors. Am I missing a file, or something like that?

How much space does Pygame take up?

This isn’t a coding problem, but I was just wondering. How much space does Pygame take up? I was just downloading Pygame, but then thought to myself about this. I mean, I am a bit concerned. It may take up a lot of space!

how to continuously deal cards out of the deck one by one when a function is run in pygame

i am writing a game that when it is run, cards are dealt out of the deck one by one(that means you should be able to see a card flow out of the deck, takes another position then the next one also gets out of the deck until all the card are finished from the deck), now the one i have written cards flow out of the deck at once and they take up another position.