-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Hi Sebastien,
I have recently been using your code to control SLM. After I switched to a different computer monitor (as main monitor), there were some problems with the code which was allowing well. I would like to give you feedback on these problems and the corresponding solutions. Maybe it will help different users.
Issue Description
In Windows, my SLM (monitor) number is displayed as 2 and the main monitor number is 1. When using wxPython, the SLM number is displayed as 1 and the main monitor number is 2. In this context, I have a problem loading images into SLM using this code.
When attempting to display an image on a specified monitor, the image consistently appears on Main Monitor regardless of the specified monitor number.
Steps to Reproduce
- Create an instance of
SLMdisplaywith any monitor number (including negative numbers and numbers exceeding the actual monitor count). - Call the
updateArraymethod to attempt displaying an image on the specified monitor. - Notice that the image window is displayed on the primary monitor instead of the specified one.
Expected Behavior
The image should appear on the monitor specified in the monitor parameter of the SLMdisplay class, or an error should be thrown if the monitor number is invalid.
Actual Behavior
The image window consistently defaults to the primary monitor, irrespective of the specified monitor number.
Proposed Fix
I've identified that the monitor parameter, though passed to the SLMdisplay class, is not being utilized correctly in the videoThread class. Here's a summary of the changes I made to address this issue:
-
In the
SLMdisplayclass, ensure that themonitorparameter is stored as a class attribute:class SLMdisplay: def __init__(self, monitor=1, isImageLock=False): self.monitor = monitor # Store the monitor parameter ...
-
**In the videoThread class, modify the run method to pass the monitor attribute to the SLMframe instance:
def run(self): app = wx.App() monitor = self.parent.monitor # Retrieve the monitor parameter
With these changes, the code now correctly displays images on the monitor specified by the user.
Best,
Yuyang