pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Pygame Window Info

Pygame Window Info - 0.1

Eric Pavey (akeric)

Tags:

Description

I needed a way to be able to query the position of the active Pygame screen relative to the desktop. There didn’t seem to be any built-in way in Pygame to do this(?) After doing some searching, I ran across Python’s ctypes bindings. These let you tap into Windows (the OS) ‘window info’. Based on fiddling with that code, I’ve come up with a Python class that lets you query a few things:

  • The extents of the active Pygame *window* relative to the desktop: top, bottom, left, and right coordinates.
  • The extents of the active Pygame *screen inside that window*, relative to the desktop: top, bottom, left, and right coordinates.
  • The width of the window border edges, and the title bar.

The source code comes with unit test allowing immediate execution from shell showcasing functionality, and example usage. Tested with Pygame 1.9.1 and Python 2.6.2. Windows OS only

Links

Home Page: http://www.akeric.com/blog/?page_id=814
Source: http://www.akeric.com/python/pygameWindowInfo/pygameWindowInfo_0_1.py

Screenshot


click to view original size

Releases

Pygame Window Info - 0.1 - Oct 25, 2009

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

No user comments have been submitted.
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Sep 17, 2014

Sep 9, 2014

Sep 8, 2014

Sep 7, 2014


Sep 5, 2014

Aug 26, 2014

Aug 22, 2014

Aug 21, 2014


Aug 18, 2014

Aug 2, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)