How to get a window ID in linux using python?

S

Sandy

Hi all,
Is there a way to get window ID in linux using python by just using
the window name (say 'VPython')?
This can be done in (Microsoft) windows (got it from somewhere else,
not tested).
import win32gui
self.VP = win32gui.FindWindow ( None, 'VPython' )

In Linux, we can get window info by executing 'xwininfo' and then
selecting the desired window manually. Can this be done automatically
in python?

Thanks,
Sandy
 
M

Martin v. Löwis

In Linux, we can get window info by executing 'xwininfo' and then
selecting the desired window manually. Can this be done automatically
in python?

You can run "xwininfo -tree -root", and then parse the output.

HTH,
Martin
 
P

Paul Boddie

You can run "xwininfo -tree -root", and then parse the output.

The desktop.windows module provides some support for inspecting
windows under X11. Here's the repository for the desktop package:

https://hg.boddie.org.uk/desktop

Looking at the time since the last release, maybe it's time to make
another release with the most recent fixes, especially since I've just
spotted something which would probably obstruct the operation of the
module when performing the work required in this case.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top