截图的部分代码:
def find_window_by_property(xlib_window, atom=WM_STATE):
''' find Window by property '''
result = xlib_window.query_tree().children
if not result:
return None
else:
for children in result:
status = children.get_property(atom, WM_HINTS, 0, 0)
if status:
child = children
else:
child = find_window_by_property(children, atom)
return child
就是我希望截取的窗口,如果被其它窗口挡住,就无法截图我想要的窗口,而是把挡住截取窗口部分也给截进来了.
截图的部分代码:
def find_window_by_property(xlib_window, atom=WM_STATE):
''' find Window by property '''
result = xlib_window.query_tree().children
if not result:
return None
else:
for children in result:
status = children.get_property(atom, WM_HINTS, 0, 0)
if status:
child = children
else:
child = find_window_by_property(children, atom)
return child
已经能获取所有子窗体了. 那就加个 补丁吧.
将 欲 截取的窗口 从 window 栈置顶吧.然后截图,这样效果更好点.
你获取的子窗口就可以设置这个属性的,给你XLIB API.你们要改啊!体验不好,看人家 shutter 弄的就很好.
有点像 gtk+ 的 keep_above...
更改窗口的栈顺序
xlib API:
XRaiseWindow(display, w)
Display *display;
Window w;
反方向的.
XLowerWindow(display, w)
Display *display;
Window w;