November 22nd, 2012, 09:00 PM
Python (pyGame Graphics) HELP! PLEASE :)
Hey guys. I know that this may a be a really dumb question and all. I was however, wondering how (using pygame), one could create a program to display this picture:
Please help. It would be greatly appreciated. Truly.
November 23rd, 2012, 07:38 AM
Do you need an introduction to calculus or an introduction to pygame? I'm willing to work with the mathematics and tkinter for graphics.
[/code] are essential for python code and Makefiles!
November 23rd, 2012, 11:06 AM
Here is an example:
experiments with module pygame
free from: http://www.pygame.org/
load and display a web image using pygame
import pygame as pg
from urllib2 import urlopen
# initialize pygame
image_url = "http://www.lorenzod8n.files.wordpress.com/2007/05/fishnet.png"
image_str = urlopen(image_url).read()
image_file = StringIO.StringIO(image_str)
# RGB color tuple used by pygame
white = (255, 255, 255)
# create a 300x300 white screen
screen = pg.display.set_mode((300,300), pg.RESIZABLE )
# load the image from a file
image = pg.image.load(image_file)
# draw image, position the image ulc at x=20, y=20
screen.blit(image, (20, 20))
# nothing gets displayed until one updates the screen
# start event loop and wait until
# the user clicks on the window corner x
for event in pg.event.get():
if event.type == pg.QUIT:
Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25