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

Re: [pygame] pygame & gtk



Pawel J. Maczewski wrote:
Now, I got a lame question - is there any possibility to use a pygme
(sdl) window as a part of gtk window? to put the sdl window into the gtk
container?
there's a little voodoo to get it working, but many people have had no problems doing this with SDL and GTK in C. here's what it pretty much needs to by in pygame...



def embed_display(window_id):
"""initializes pygame into an embedded window.
must be called before any of pygame is initialized"""

#first, set the environment variables
os.environ['SDL_WINDOWID'] = str(window_id)
if sys.platform.startswith('win'): #disable directx
os.environ['SDL_VIDEODRIVER'] = 'windib'

#next, make it happen
pygame.init()
size = 100, 100 #doesn't really matter
return pygame.display.set_mode(size)


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