$12 GRAYBYTE WORDPRESS FILE MANAGER $32

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.15.130 | ADMIN IP 216.73.216.174
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/pyvirtualdisplay/examples/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/pyvirtualdisplay/examples//threadsafe.py
"Start Xvfb server and open xmessage window. Thread safe."

import threading

from easyprocess import EasyProcess

from pyvirtualdisplay.smartdisplay import SmartDisplay


def thread_function(index):
    # manage_global_env=False is thread safe
    with SmartDisplay(manage_global_env=False) as disp:
        cmd = ["xmessage", str(index)]
        # disp.new_display_var should be used for new processes
        # disp.env() copies global os.environ and adds disp.new_display_var
        with EasyProcess(cmd, env=disp.env()):
            img = disp.waitgrab()
            img.save("xmessage{}.png".format(index))


t1 = threading.Thread(target=thread_function, args=(1,))
t2 = threading.Thread(target=thread_function, args=(2,))
t1.start()
t2.start()
t1.join()
t2.join()


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
11 Feb 2026 9.30 AM
root / root
0755
__pycache__
--
11 Feb 2026 9.30 AM
root / root
0755
__init__.py
0 KB
20 Jan 2026 1.01 PM
root / root
0644
headless.py
0.239 KB
20 Jan 2026 1.01 PM
root / root
0644
lowres.py
0.26 KB
20 Jan 2026 1.01 PM
root / root
0644
nested.py
0.719 KB
20 Jan 2026 1.01 PM
root / root
0644
screenshot.py
0.575 KB
20 Jan 2026 1.01 PM
root / root
0644
threadsafe.py
0.754 KB
20 Jan 2026 1.01 PM
root / root
0644
vncserver.py
0.277 KB
20 Jan 2026 1.01 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF