monitorcontrol icon indicating copy to clipboard operation
monitorcontrol copied to clipboard

Not compatible with pyglet.window.Window

Open skjerns opened this issue 2 years ago • 2 comments

Great tool!

I discovered a bug that appears when using monitortool together with pyglet:

import monitorcontrol
from pyglet.window import Window

monitorcontrol.get_monitors()

# ArgumentError: argument 2: <class 'TypeError'>: expected LP_RECT instance instead of int
# TypeError: catching classes that do not inherit from BaseException is not allowed

image

Do you think there is any way to repair that?

  • Operating system: Win 10
  • Python version: 3.9.7
  • monitorcontrol version (monitorcontrol --version): 3.0.0 (dev)

skjerns avatar Apr 25 '22 08:04 skjerns

It's using 0 instead of a null pointer for that one, which is valid as far as I know. Maybe it wants something along the lines of POINTER(LP_RECT)()? Feel free to open a pull-request if you find something that passes the type check.

newAM avatar Apr 26 '22 03:04 newAM

My workaround for now was just starting the function via subprocess. It works, so I'm satisfied with that workaround for now. Even has the advantage of being non-blocking (the library can take a few seconds to load sometimes).

    subprocess.Popen('monitorcontrol --set-luminance 0 --monitor 1', shell=True)

skjerns avatar Apr 26 '22 06:04 skjerns