pygame

Screen only updates when I check for user input pygame

大兔子大兔子 提交于 2020-01-11 10:31:46
问题 I'm using pygame and updating to the screen every loop of the main loop. What I don't understand is nothing will update until I add a for loop looking for events, then suddenly all the updating does occur. Why is this? def run(self): two_pm = get_stand_up_timestamp() pygame.init() font = pygame.font.Font(None, 72) screen = pygame.display.set_mode(self._dimensions) before_two = True while before_two: # Blit the time to the window. # Update Screen. current_time = datetime.datetime.now() text =

pygame not working with portable python

房东的猫 提交于 2020-01-11 10:21:51
问题 I'm trying to get pygame working with portable python 3.2.1.1 running off a USB stick, but when I use the following code: import pygame, sys It says: ImportError: No module named pygame My understanding was that pygame came embedded in portable python. Can anyone help? 回答1: Pygame does not come embeded in portable python 3.2. Tho it comes in the 2.7 version. Sources: http://portablepython.com/wiki/PortablePython3.2.1.1 - 3.2 (No pygame here!) http://portablepython.com/wiki/PortablePython2.7.3

Why won't my button change color when i hover over it pygame?

谁说我不能喝 提交于 2020-01-11 10:05:14
问题 I'm new to pygame and have been attempting to create a simple interface with some buttons. I can't get the button to change color when the mouse hovers over it. I've managed to create the button, but cannot get it to interact with my mouse. The code create an button object with one instance of a green button. It should change the button from green to red when mouse hovers over. import pygame pygame.init() display_width = 1200 display_height = 600 black = (0, 0, 0) white = (255, 255, 255) red

Using Pygame without installing

核能气质少年 提交于 2020-01-11 09:25:10
问题 I'm making a real simple RPG game at college and I would like to use pygame. However, my college has a group policy disabling any Windows executables from running so I can't install pygame. Is there any way I can just import pygame by just having it in the same folder? 回答1: One thing I do with external python libraries is to download the source, build it and copy the built library into ${ PROJECT_HOME }/lib/${ EXTERNAL_LIB_NAME }. This way, I can run my python scripts with just standard

How to install pygame for python3.5 in Ubuntu16.04?

孤街浪徒 提交于 2020-01-10 11:14:52
问题 I've spent hours for installing pygame , but it I didn't succeed. I want a detailed installing instruction for pygame in python3.5 in Ubuntu16.04. And I think it's a meaningful work for other people. 回答1: You probably do not have pip3.5 installed, so I believe you it's not been easy. So one solution may be to start installing pip3.5 . Based on this article on how to install pip3 in Ubuntu, here's a possible solution for your problem. First install setuptools for Python 3 sudo apt-get install

How to install pygame for python3.5 in Ubuntu16.04?

為{幸葍}努か 提交于 2020-01-10 11:10:54
问题 I've spent hours for installing pygame , but it I didn't succeed. I want a detailed installing instruction for pygame in python3.5 in Ubuntu16.04. And I think it's a meaningful work for other people. 回答1: You probably do not have pip3.5 installed, so I believe you it's not been easy. So one solution may be to start installing pip3.5 . Based on this article on how to install pip3 in Ubuntu, here's a possible solution for your problem. First install setuptools for Python 3 sudo apt-get install

Process finished with exit code -1073741515 (0xC0000135)

爷,独闯天下 提交于 2020-01-10 10:09:07
问题 im running a python script and it used to work, even does on my laptop right now but not on my other computer - i just get the error code: Process finished with exit code -1073741515 (0xC0000135) I dont get any other results - not even from "print" commands at the beginning of the file. I havent found anything specific to that.. I re-installed python (2.7.9), pygame (1.9.1) and even pycharm (tried 4.5 first, now with 5.0 - same result) Does anyone know what that error code means? I couldnt

Process finished with exit code -1073741515 (0xC0000135)

我的未来我决定 提交于 2020-01-10 10:07:46
问题 im running a python script and it used to work, even does on my laptop right now but not on my other computer - i just get the error code: Process finished with exit code -1073741515 (0xC0000135) I dont get any other results - not even from "print" commands at the beginning of the file. I havent found anything specific to that.. I re-installed python (2.7.9), pygame (1.9.1) and even pycharm (tried 4.5 first, now with 5.0 - same result) Does anyone know what that error code means? I couldnt

How to rotate slices of a Rubik's Cube in python PyOpenGL?

房东的猫 提交于 2020-01-10 05:47:06
问题 I'm attempting to create a Rubik's Cube in Python, i have gotten as far as visually representing the cube. Struggling a bit with how to implement rotation. I guess i'm asking for feedback as to how to go about doing this. I thought at first of, rotating each cubes set of vertices's, without much luck. I basically want to select a slice from an array of cube objects (of varying size), perform a rotation and a translation on each object. import pygame import random from pygame.locals import *

Pygame Making A Sprite Face The Mouse

左心房为你撑大大i 提交于 2020-01-10 04:18:17
问题 Im New To Pygame But Kinda OK On Python, Im Creating A Zombie Shooting Game With an overhead view. I managed to make the character move when pressing the arrow keys. But now i need to get the player to FACE the mouse/cursor without clicking the screen all the time. Any Help? 回答1: for event in pygame.event.get(): if event.type == MOUSEMOTION: mousex, mousey = event.pos # build a vector between player position and mouse position moveVector = (mousex-playerx, mousey-playery) """ compute the