pygame

How to install pygame font

余生长醉 提交于 2019-12-24 14:36:57
问题 This is a beginner level question. I am teaching myself pygame on ubuntu 10.10. I downloaded a couple of examples and pygame isn't working right. I suspect an install problem. But I'm not sure how to figure it out. Is there something else I have to install to make this work? My example: http://cid-bb9549bdfdec74f4.skydrive.live.com/self.aspx/PyPlotter/pyplotter.py My error: prompt: python pyplotter.py pyplotter.py:27: RuntimeWarning: use font: No module named font (ImportError: No module

Error while installing pygame using pip for python 3.4

微笑、不失礼 提交于 2019-12-24 14:35:00
问题 Sorry, thought i edited to say i am on windows 64 bit When trying to install Pygame using pip, I get the following error: "requirement 'pygame.whl' looks like a file name, but the file does not exist pygame.whl is not a valid wheel filename." I have my file paths right and pip is working. I have attempted to install 32 bit and 64 bit pygame but neither is working. In the command prompt I enter "pip install pygame.whl" (I renamed the file which I don't think should matter and it is saved under

side scrolling background (python) - not 100% working

扶醉桌前 提交于 2019-12-24 14:28:11
问题 Hi there i am working on a side scrolling abckground to put in my game, heres what ive got at the moment: import pygame import sys import pygame.sprite as sprite theClock = pygame.time.Clock() background = pygame.image.load('space.jpg') background_size = background.get_size() background_rect = background.get_rect() screen = pygame.display.set_mode(background_size) w,h = background_size x = 0 y = 0 x1 = 0 y1 = -h running = True while running: screen.blit(background,background_rect) pygame

Weird bug in program that “turns off” certain objects after they are used

一曲冷凌霜 提交于 2019-12-24 13:09:54
问题 I'm trying to create a "text based game" in a window, using fonts and makeshift buttons. Everything works fine, but when there are multiple buttons on the screen and only one is pressed, the others' collisions carry over to the next screen and mess everything up. While doing debugging, I noticed that pressing the button on the next screen briefly works, but then goes to the 2nd button from the first screen, ex. I press the first button, button on second screen works, but bugs out by

Function with input prints out nothing

别说谁变了你拦得住时间么 提交于 2019-12-24 12:17:57
问题 Ok so I'm trying to get z.ExNote() to print out an image (of an 8th note) onto a page of sheet music for an app I'm building. Basically every variable just has to do with the (x,y) coordinates of where the note is to be placed. .ExNote() is a function inside a class Note which translates 5 variables of the Note object (Num, staff, measure, note, notetype) into an x,y coordinate for the image to be placed on. This whole mess takes care of 4 variables for you so you can theoretically input the

How to installing Pygame for Python 3.5 via pip?

一世执手 提交于 2019-12-24 11:45:07
问题 I'm trying to install Pygame for python 3.5 32bit. I have learned that I can open the .whl files provided on the site by using the pip command. The problem is I've tried multiple ways doing this but with constant error. python -m pip install pygame-1.9.2a0-cp35-none-win32.whl 'python' is not recognized as an internal or external command, operable program or batch file. The file I'm trying to install: pygame-1.9.2a0-cp35-none-win32.whl My python program is located in my programs folder and

Updating part of a surface in python, or transparent surfaces

懵懂的女人 提交于 2019-12-24 11:28:04
问题 I have an application written in python that's basically an etch-a-sketch, you move pixels around with WASD and arrow keys and it leaves a trail. However, I want to add a counter for the amount of pixels on the screen. How do I have the counter update without updating the entire surface and pwning the pixel drawings? Alternatively, can I make a surface that's completely transparent except for the text so you can see the drawing surface underneath? 回答1: To solve this problem, you want to have

pygame/python sprite not moving? What have i done wrong? (no errors)

送分小仙女□ 提交于 2019-12-24 11:22:18
问题 Alright, so here's my code, I get no errors but my sprite (player) is not moving import pygame,sys import random import time #Colors white = (255,255,255) black = (0,0,0) red = (255,0,0) green = (0,255,0) blue = (0,0,255) class Block(pygame.sprite.Sprite): def __init__(self, color = blue, width = 50, height = 50): super(Block, self).__init__() self.image = pygame.Surface((width, height)) self.image.fill(color) self.rect = self.image.get_rect() def set_position(self, x , y): self.rect.x = x

Call function by button click in Pygame

浪尽此生 提交于 2019-12-24 10:51:46
问题 I got a screen with buttons in Pygame here in the code below. Now I want to click the button, then a random() function starts and after 5 seconds it returns to the screen from the beginning with the buttons and let me the option to click again and call a random function again. def loop(): clock = pygame.time.Clock() number = 0 # The button is just a rect. button = pygame.Rect(300,300,205,80) done = False while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done =

Python/Pygame How to make my Score Text update itself forever?

自作多情 提交于 2019-12-24 10:46:00
问题 I am currently creating a game in which (for now) the score gains 1 point every second. However, with my current code (which I believe DOES change the variable every second) whenever I run the program, the text doesn't change. It just stays at 0. Here is my code: (I've provided text in this question to explain my code, like comments.) SECTION 1: Importing PyGame and other standard procedure code. import sys, pygame from pygame.locals import * pygame.init() size = width, height = 800,500