3
는 다음 코드 (http://pastebin.com/rNkUj5V8)를 발견했다,하지만 난 오히려 직접 조회를 사용하는 것입니다 : 내가 직접 Window 객체를 인스턴스화 시도ID로 Xlib.display.Window 인스턴스를 얻는 방법은 무엇입니까?
import Xlib
import Xlib.display
def get_window_by_id(winid):
mydisplay = Xlib.display.Display()
root = mydisplay.screen().root # should loop over all screens
inspection_list = [root]
while len(inspection_list) != 0:
awin = inspection_list.pop(0)
if awin.id == winid:
return awin
children = awin.query_tree().children
if children != None:
inspection_list += children
return None
# use xwininfo -tree to click on something (panel was good for me)
# until you find a window with a name, then put that id in here
print get_window_by_id(0x1400003)
print get_window_by_id(0x1400003).get_wm_name()
을, 그러나 get_attributes
에 대한 호출이 실패
w = Xlib.xobject.drawable.Window(Xlib.display.Display(), 67142278)
w.get_attributes()
/usr/lib/python2.7/dist-packages/Xlib/display.pyc in __getattr__(self, attr)
211 return types.MethodType(function, self)
212 except KeyError:
--> 213 raise AttributeError(attr)
214
215 ###
AttributeError: send_request