ponty / PyVirtualDisplay

Python wrapper for Xvfb, Xephyr and Xvnc
BSD 2-Clause "Simplified" License
714 stars 78 forks source link

How to take screen number? #54

Closed ymd-h closed 4 years ago

ymd-h commented 4 years ago

Thank you for your useful package.

I uses PyVirtualDisplay to visualize reinforcement learning environment (OpenAI Gym) on Google Corab, so that I need display number and screen number to set os.environ["DISPLAY"] = f":{display}.{screen}"

Are there any stable method to take screen number? (or is it guaranteed that the screen number is always 0?)

ponty commented 4 years ago

I never used screen number. AFAIK it is only needed when you want to have multiple screens in a display. Is this what you need? Screen is always 0 in PyVirtualDisplay. Environment is aleready set in start() like this:

os.environ["DISPLAY"] = f":{display}"

https://linux.die.net/man/1/xvfb "By default, only screen 0 exists .." "Xvfb :1 -screen 1 1600x1200x16 The server will listen for connections as server number 1, will have the default screen configuration (one screen, 1280x1024x8), and screen 1 will be depth 16 1600x1200. "

ymd-h commented 4 years ago

Hi, @ponty

Thanks for your answer!

Actually, I misunderstood detail of DISPLAY environment. I could confirm by myself that the screen number is not necessary in this case.