What is the best way to use PyGame (SDL) within a PyGTK application?
I'm searching for a method that allows me to have a drawing area in the GTK window and at the same time being able to manage both GTK and SDL events.
...
In a pyGame application, I would like to render resolution-free GUI widgets described in SVG.
What tool and/or library can I use to reach this goal ?
(I like the OCEMP GUI toolkit but it seems to be bitmap dependent for its rendering)
...
If I want to move to C++ and SDL in the future, is Python and pygame a good way to learn SDL?
...
I would like to draw lines (of arbitrary position and length) onto a surface in pygame, which itself is an image loaded from a file on disk.
Can anyone point me to some example code that does this?
...
Can someone give me some example code that creates a surface with a transparent background in pygame?
...
Hello,
I want to develop a very simple 2D game in Python. Pygame is the most popular library for game development in Python, but I'm already quite familiar with wxPython and feel comfortable using it. I've even written a Tetris clone in it, and it was pretty smooth.
I wonder, what does Pygame offer in terms of graphics (leaving sound a...
I am trying to create an application like the one here:
http://www.eigenfaces.com/
Basically lots of overlapping circles drawn with pygame. I cannot figure out how the blend the circles to make them translucent. That is to have overlapping colors show through. My code so far is this:
import sys, random, time
import pygame
from pygame....
I've had some experience with Pygame, but there seems to be a lot of buzz around Pyglet these days.
How do these two libraries compare? What would be the advantage of using one over the other, both in features and ease of use?
Finally, would you say that one is more Pythonic than the other?
...
I have one class that needs to grab an attribute that is set in another. It's not a standard data type though. Here's the code;
class graphics:
def __init__(self, Fullscreen = False, Width = 640, Height = 480):
print "Graphics Init"
SCREEN_SIZE = (Width, Height)
pygame.init()
if Fullscreen:
self.screen = pygame.d...
What is the canonical way of making your sprites respond to mouse clicks in PyGame ?
Here's something simple, in my event loop:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit_game()
[...]
elif ( event.type == pygame.MOUSEBUTTONDOWN and
pygame.mouse.get_pressed()[0]):
for sp...
I'm curious to know what commercial games, if any, have been written with pyGame. The scale doesn't matter much, it doesn't have to be a massive success, but it should be significant that more than 2 people have ever heard of it.
I ask this because nearly everything I saw on the pyGame website seemed fairly underwhelming. I understand...
I have the following code:
import math
import pygame
from pygame.locals import *
# Initialize PyGame
pygame.init()
pygame.display.set_mode((800,600))
quit = False
roundtime = 20 # ms
nextupdate = pygame.time.get_ticks() + roundtime
framenum = 0
# Watering radius
r = 25
# Time step
dt = 1 # min
field = [0.0]*80*60
while not quit:
...
Is it possible to get a fully transparent window in Pygame (see the desktop through it)? I've found how to create a window without a frame, but there doesn't seem to be any obvious way to make it transparent.
I'd be willing to tie into system-specific technology/frameworks as long as there are solutions for both Windows and Mac OS X, b...
I am developing a simple game in PyGame... A rocket ship flying around and shooting stuff.
Question: Why does pygame stop emitting keyboard events when too may keys are pressed at once?
About the Key Handling: The program has a number of variables like KEYSTATE_FIRE, KEYSTATE_TURNLEFT, etc...
When a KEYDOWN event is handled, it ...
I'm building a relatively simple programme to test collision detection, it's all working fine at the moment except one thing, I'm trying to make the background colour change randomly, the only issue is that it appears to be completely skipping the function to do this;
import pygame
from pygame.locals import *
import random, math, time, ...
Here's a small sample section of some code I'm writing with python and pygame, for some reason it seems to be claiming that some seemingly very simple and apparently accurate things are syntax errors. Here's possibly the most annoying example.
def Draw():
Surface.fill((255,255,255))
for square in squares:
pygame.draw.rec...
As I see it, there are two ways to handle mouse events to draw a picture.
The first is to detect when the mouse moves and draw a line to where the mouse is, shown here. However, the problem with this is that with a large brush size, many gaps appear between each "line" that is not straight since it is using the line's stroke size to c...
Surface.blit has a new parameter in 1.8: blend. The following values are defined:
BLEND_ADD
BLEND_SUB
BLEND_MULT
BLEND_MIN
BLEND_MAX
BLEND_RGBA_ADD
BLEND_RGBA_SUB
BLEND_RGBA_MULT
BLEND_RGBA_MIN
BLEND_RGBA_MAX
BLEND_RGB_ADD
BLEND_RGB_SUB
BLEND_RGB_MULT
BLEND_RGB_MIN
BLEND_RGB_MAX
Can someone explain what these modes mean?
...
I have been playing around with writing some simple card games in Python for fun and I would like to add a graphical user interface (GUI) to the games. Which library would you recommend for writing the GUI for a simple card game?
...
I'm using pygame to draw a line between two arbitrary points. I also want to append arrows at the end of the lines that face outward in the directions the line is traveling.
It's simple enough to stick an arrow image at the end, but I have no clue how the calculate the degrees of rotation to keep the arrows pointing in the right direct...