pygame-surface

Pygame : smooth picture aparition

删除回忆录丶 提交于 2020-06-29 06:54:20
问题 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': image(background,0,0) image(title, 640, 120) pygame.display.update() But texte appaers suddently and not as I would like... 回答1: You want to use transparency, and pygame uses three different types: There are three types of transparency supported in pygame: colorkeys, surface

Pygame not returning events while embedded in PyQt

旧城冷巷雨未停 提交于 2020-05-09 07:29:29
问题 I'm testing out an application and the UI uses PyQt4 with Pygame embedded into it. It uses a timer to "update" itself so to speak and in the timerEvent function Pygame attempts to retrieve all detected events. Issue is, Pygame isn't detecting any events. Here's a minimalist version of my code #!/etc/python2.7 from PyQt4 import QtGui from PyQt4 import QtCore import pygame import sys class ImageWidget(QtGui.QWidget): def __init__(self,surface,parent=None): super(ImageWidget,self).__init__

pygame.display.update runs after pygame.time.wait(1000)

故事扮演 提交于 2020-02-25 06:44:25
问题 I am working through a tutorial. The tutorial can be found here https://inventwithpython.com/makinggames.pdf The main script i am referring to can be found here https://inventwithpython.com/memorypuzzle.py There is a bug in this program that I have been trying to resolve for days. In the main game loop ` while True: # main game loop mouseClicked = False DISPLAYSURF.fill(BGCOLOR) # drawing the window drawBoard(mainBoard, revealedBoxes) for event in pygame.event.get(): # event handling loop if

pyagme screen not working with multithreading

心不动则不痛 提交于 2020-01-06 09:04:52
问题 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 screen.get_width() for example) the following error is raised: Process Process-1: Traceback (most recent call last): File "C:\Python27\lib\multiprocessing\process.py", line 267, in _bootstrap self.run() File "C:\Python27\lib\multiprocessing\process.py"

pyagme screen not working with multithreading

岁酱吖の 提交于 2020-01-06 09:04:20
问题 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 screen.get_width() for example) the following error is raised: Process Process-1: Traceback (most recent call last): File "C:\Python27\lib\multiprocessing\process.py", line 267, in _bootstrap self.run() File "C:\Python27\lib\multiprocessing\process.py"

pyagme screen not working with multithreading

╄→гoц情女王★ 提交于 2020-01-06 09:04:18
问题 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 screen.get_width() for example) the following error is raised: Process Process-1: Traceback (most recent call last): File "C:\Python27\lib\multiprocessing\process.py", line 267, in _bootstrap self.run() File "C:\Python27\lib\multiprocessing\process.py"

How to convert a group of images into a single data_test.npz file?

谁说我不能喝 提交于 2020-01-06 02:39:14
问题 I am building a self driving RC car. I have 100s of images taken from pi camera and each one of them are named as direction.jpg . How do I convert these images into single .npz file so that I can train a Neural net. The code below is a simple python script that enables my car to move on key press and snaps photos every second. #!/usr/bin/env python """Interactive control for the car""" import time import io import pygame import pygame.font import picamera import configuration import helpers

How to present numpy array into pygame surface?

北慕城南 提交于 2020-01-03 08:55:10
问题 I'm writing a code that part of it is reading an image source and displaying it on the screen for the user to interact with. I also need the sharpened image data. I use the following to read the data and display it in pyGame def image_and_sharpen_array(file_name): #read the image data and return it, with the sharpened image image = misc.imread(file_name) blurred = ndimage.gaussian_filter(image,3) edge = ndimage.gaussian_filter(blurred,1) alpha = 20 out = blurred + alpha*(blurred - edge)