[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: [pygame] Embedding pygame?



Title: AW: [pygame] Embedding pygame?

On a similar question Kevin told me the following; but unfortunately I didn't try it:
----snip----
The comments below are for PythonCard. If you are using wxPython by itself,
then each window has the GetHandle() call, you don't need the _delegate part
which is specific to PythonCard which wraps all of the wxPython windows.

ka

-----Original Message-----
From: Pete Shinners [mailto:pete@shinners.org]
Sent: Tuesday, September 11, 2001 8:32 AM
To: Kevin Altis
Subject: Re: wxPython and pyGame


> I heard you managed to do the trick to display a pygame surface in an
> wxPython frame ... can you tell me how, maybe send a code snippet?

yes, i did manage. it's actually not too hard.
first, make sure you've got pygame-1.2 (which shouldn't be tough).
if you are on windows you will need the latest CVS version of
SDL-1.2.3 (anything less won't work). on unix, you should be
fine with anything since SDL-1.2


anyways, once you have that you are ready to roll.
wxpython has a command to get the system window id
for any control. it is inside a hidden "_delegate"
member, so you would say "MyControl._delegate.GetHandle()"

what you want to do is set an environment variable
named "SDL_WINDOWID" with this value. also, if you are
on windows, you need to use the 'windib' driver, not 'directx'

id = imgDraw._delegate.GetHandle()
os.environ['SDL_WINDOWID'] = str(id)
if sys.platform == 'win32':
    os.environ['SDL_VIDEODRIVER'] = 'windib'


make sure you do that before calling pygame.init(). then
you make a pygame.display.set_mode() call as usual. i'm
guessing it just ignores the size arguments you pass it,
but i've always just given it the right size


that should do it for you. let me know if otherwise :]

----snip----

-----Ursprungliche Nachricht-----
Von: pygame@lee-morgan.net [mailto:pygame@lee-morgan.net]
Gesendet: Freitag, 1. Marz 2002 02:47
An: pygame-users@seul.org
Betreff: Re: [pygame] Embedding pygame?


Pete Shinners <shredwheat@attbi.com> writes:
>
> the sdl window can run in embedded gui's, but it seems to be sort of hit and
> miss. for example, i've seen it working with wxpython, but hear there's no luck
> with pyqt. running inside an IE activex control seems like a longshot, but i

Are there any examples with wxPython knocking around?

Thanks.

--
pygame


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org