Questo è il risultato di un paio d'ore di smanettamento:
#!/usr/bin/python
import pygame, sys, os
from pygame.locals import *
screenwidth = 800
screenheight = 600
pygame.init()
# set screen resolution
pygame.display.set_mode((screenwidth, screenheight))#, pygame.FULLSCREEN)
screen = pygame.display.get_surface()
back_file_name = os.path.join(".","Atlantis_by_aksu.jpg")
back_surface = pygame.image.load(back_file_name)
font = pygame.font.Font(None, 36)
text = font.render("Guarda un film", 1, (255, 255, 255))
textpos = text.get_rect()
textpos.centerx = back_surface.get_rect().centerx
back_surface.blit(text, textpos)
fore_surface = pygame.transform.scale(back_surface, (screenwidth, screenheight))
screen.blit(fore_surface, (0,0))
pos = 0,0
def input(events):
for event in events:
if event.type == MOUSEBUTTONDOWN:
sys.exit(0)
elif event.type == MOUSEMOTION:
global pos
pos = pygame.mouse.get_pos()
screen.blit(back_surface, (pos[0],pos[1]))
else:
print event
# Main loop
while True:
input(pygame.event.get())
pygame.display.flip()
Nessun commento:
Posta un commento