How to use the pyvirtualdisplay.randomize.Randomizer function in PyVirtualDisplay

To help you get started, we’ve selected a few PyVirtualDisplay examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ponty / PyVirtualDisplay / tests / test_core.py View on Github external
def test_random():
    r = Randomizer()
    vd = Display(randomizer=r).start().stop()
    assert vd.return_code == 0
    # assert r.min <= vd.display <= r.min + r.delta # can be auto nr
    assert not vd.is_alive()
github catalyst-team / catalyst / catalyst / rl / environment / environment.py View on Github external
observation_std: np.ndarray = None,
        action_mean: np.ndarray = None,
        action_std: np.ndarray = None,
        visualize: bool = False,
        mode: str = "train",
        sampler_id: int = None,
        use_virtual_display: bool = False
    ):
        super().__init__(visualize=visualize, mode=mode, sampler_id=sampler_id)

        if use_virtual_display:
            # virtual display hack
            from pyvirtualdisplay import Display
            from pyvirtualdisplay.randomize import Randomizer
            self.display = Display(
                visible=0, size=(1366, 768), randomizer=Randomizer())
            self.display.start()

        self.env = env

        self._history_len = history_len
        self._frame_skip = frame_skip
        self._reward_scale = reward_scale
        self._step_reward = step_reward
        self._max_fps = max_fps if self._mode == "train" else None
        self._min_delay_between_steps = 1. / self._max_fps \
            if self._max_fps is not None \
            else 0
        self._last_step_time = time.time()

        self.observation_mean = np.array(observation_mean) \
            if observation_mean is not None else None