[pygame] Re: Query Pygame window position after creation?

2009-10-26 Thread Eric Pavey
Bit more poking, and I got the problem solved.  If anyone was interested I
put it up on my blog with link to source code:
http://www.akeric.com/blog/?page_id=814


[pygame] Re: Query Pygame window position after creation?

2009-10-17 Thread Eric Pavey
So, I can partly reply to my own post:  I found a way to do this on Windows
(shown below).  But I realize this returns the location of the window, I
need to know the location of the display screen (pygame surface).  The
values this returns are the outer window extents, including title-bar, outer
window frame, and these can vary based on the UI.  So I guess I should
re-ask my question:

For a given Pygame surface, how can I query its position in the screen
(computer screen, not pygame display)

from ctypes import POINTER, WINFUNCTYPE, windll
from ctypes.wintypes import BOOL, HWND, RECT

# get our window ID:
hwnd = pygame.display.get_wm_info()["window"]

# Jump through all the ctypes hoops:
prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT))
paramflags = (1, "hwnd"), (2, "lprect")
GetWindowRect = prototype(("GetWindowRect", windll.user32), paramflags)

# finally get our data!
rect = GetWindowRect(hwnd)
print "top, left, bottom, right: ", rect.top, rect.left, rect.bottom, rect.right
# bottom, top, left, right:  644 98 124 644


[pygame] Query Pygame window position after creation?

2009-10-17 Thread Eric Pavey
I've been searching, but not finding:  Is there any way to query the
location of the Pygame window after creation?  There doesn't seem to be an
event that is triggered when the window is moved, but there is an event for
when it is resized.  I've found the post describing how you can control its
creation position like so:

os.environ['SDL_VIDEO_WINDOW_POS'] = "10,10"

But once its made, and the user has moved it, how to query the updated
position?  Would also like to know if there was an event or callback
triggered when the window has been moved.
Presumably it'd return the location of one of the corners...
Many thanks.


Re: [pygame] Window position

2008-11-02 Thread Lenard Lindstrom

Luca wrote:

Hi all.

There is a way to open a game window at the center of the screen and
not in the topleft corner? I can't find any APIs related to window
position...

Thanks!

  

For future reference this question is answered in the Pygame FAQ:

http://www.pygame.org/wiki/FrequentlyAskedQuestions

--
Lenard Lindstrom
<[EMAIL PROTECTED]>



Re: [pygame] Window position

2008-11-02 Thread Lenard Lindstrom

Jake b wrote:

I guess that means in the SDL docs, if not in pygame docs.

  
It's not an official SDL feature, so it subject to change. But it has 
around long enough it will probably stay.


--
Lenard Lindstrom
<[EMAIL PROTECTED]>



Re: [pygame] Window position

2008-11-01 Thread Jake b
I guess that means in the SDL docs, if not in pygame docs.

-- 
Jake


Re: [pygame] Window position

2008-11-01 Thread Noah Kantrowitz


On Nov 1, 2008, at 1:50 PM, Luca wrote:

On Sat, Nov 1, 2008 at 9:46 PM, Ian Mallett <[EMAIL PROTECTED]>  
wrote:

Hi,

Call this:

import os
os.environ['SDL_VIDEO_CENTERED'] = '1'

before pygame stuff.

Cheers,
Ian



Thanks very much! But where I could find those type of undocumented  
infos?


In the documentation: ftp://ptah.lnf.kth.se/pub/misc/sdl-env-vars

--Noah


Re: [pygame] Window position

2008-11-01 Thread Luca
On Sat, Nov 1, 2008 at 9:46 PM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Call this:
>
> import os
> os.environ['SDL_VIDEO_CENTERED'] = '1'
>
> before pygame stuff.
>
> Cheers,
> Ian
>

Thanks very much! But where I could find those type of undocumented infos?

-- 
-- luca


Re: [pygame] Window position

2008-11-01 Thread Ian Mallett
Hi,

Call this:

import os
os.environ['SDL_VIDEO_CENTERED'] = '1'

before pygame stuff.

Cheers,
Ian


[pygame] Window position

2008-11-01 Thread Luca
Hi all.

There is a way to open a game window at the center of the screen and
not in the topleft corner? I can't find any APIs related to window
position...

Thanks!

-- 
-- luca