#9260 NORM Not Tri: pippy examples can adapt to screen dimensions
Zarro Boogs per Child
bugtracker at laptop.org
Tue Feb 17 06:07:24 EST 2009
#9260: pippy examples can adapt to screen dimensions
----------------------------+-----------------------------------------------
Reporter: skierpage | Owner: cjb
Type: defect | Status: new
Priority: normal | Milestone: Not Triaged
Component: pippy-activity | Version:
Keywords: | Next_action: never set
Verified: 0 | Deployment_affected:
Blockedby: | Blocking:
----------------------------+-----------------------------------------------
All the pippy graphics examples I looked at hardcode
{{{
# XO screen is 1200x900
size = width, height = 1200, 900
}}}
but that makes the activity resolution-dependent. Bad for emulation, and
on the XO if you rotate the screen, Bounce's word goes off the side, etc.
I read http://www.pygame.org/docs/ref/display.html and it seems pygame
defaults to full-screen and can determine display size.
I've never written a line of Python before but this fixes the Bounce
example to work rotated:
{{{
# Don't need to set a screen resolution (SDL 1.2.10 and above),
# we can determine it dynamically (pygame 1.8.0 and above).
if pygame.get_sdl_version() < (1, 2, 10) or pygame.version.vernum < (1, 8,
0) :
exit('Warning, version of Pygame too old,exiting!')
screen = pygame.display.set_mode()
# Ask for display's width and height.
display = pygame.display.Info()
size = width, height = display.current_w, display.current_h
}}}
or maybe better request the screen's size and width instead of the
display's, so last two lines become (untested):
{{{
size = width, height = screen.get_size()
}}}
--
Ticket URL: <http://dev.laptop.org/ticket/9260>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system
More information about the Bugs
mailing list