[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] get_wm_info on linux
hi
i create subwindow for mplayer like this:
first you need some imports:
from ctypes import *
Xlib = CDLL("libX11.so.6")
Xtst = CDLL("libXtst.so.6")
def create_subwindow(x,y,width,height):
pygame_win = pygame.display.get_wm_info()["window"]
dpy = Xtst.XOpenDisplay(None)
win = Xlib.XCreateSimpleWindow (dpy, pygame_win, x,y,width,height,0,0,1)
Xlib.XCirculateSubwindows(dpy,win,1)
Xlib.XFlush(dpy)
return win
you can then force mplayer into that subwindow:
yourfavoriteexeccommand("mplayer -wid %s" % (win))
you can resize it like this:
def move_subwin(win,x,y,width,height):
dpy = Xtst.XOpenDisplay(None)
Xlib.XMoveResizeWindow(dpy,win,x,y,width,height)
Xlib.XFlush(dpy)
and you can destroy it like this:
def destroy_subwin(win):
dpy = Xtst.XOpenDisplay(None)
Xlib.XDestroyWindow(dpy,win)
Xlib.XFlush(dpy)
hope it helps :)
Lenard Lindstrom wrote:
Greg Ewing wrote:
It seems like it should be possible to get the
long from the PyCObject (info['display']) just as well
as it was done from the c code
PyCObjects are opaque from Python code -- there's no way
to extract an address from one without using C code.
ctypes can.