← Back to team overview

sikuli-driver team mailing list archive

[Bug 2007980] Re: Screen size wrong when changing monitor scaling programatically --- workaround 2.0.6-SNAPSHOT

 

This is my test script:

# start with resolution 100
popup("change from now: %s" % SCREEN)
# on popup change the resolution to 125 and click popup ok
Screen.resetMonitors()
scr = Screen(0)
# an image taken with resolutiopn 125
img = "img.png"
popup("changed: %s" % scr) # shows the new size
print scr.exists(img, 0) # shows the valid match
popup("reset to 100")
# on popup change the resolution to 100 and click popup ok
Screen.resetMonitors()
scr = Screen(0)
print scr.exists(img, 0) # shows None = not found

Resolution change is done manually in the Settings.

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to SikuliX.
https://bugs.launchpad.net/bugs/2007980

Title:
  Screen size wrong when changing monitor scaling programatically ---
  workaround 2.0.6-SNAPSHOT

Status in SikuliX:
  In Progress

Bug description:
  ------------- workaround (needs 2.0.6-SNAPSHOT)
  after changing the monitor setup programmatically (e.g. scaling factor), you have to use:
  Screen.resetMonitors()
  to let SikuliX reevaluate the monitor setup.

  This works when running scripts from command line or in the IDE
  and in Java programs.

  --- Be aware for scripts: 
  undotted Region methods (targeting the global SCREEN) can no longer be used after a resetMonitors().

  So instead of
  find(someImage)

  you have to use
  scr.find(someImage)

  having done scr = Screen(0) before once after each
  Screen.resetMonitors()

  --- Be aware: The IDE GUI might look odd, because the changed monitor
  parameters do not seem to be recognised yet everywhere (a bug ;-).

  Either reset the monitors programatically to what they where at start
  of the script before ending the script or restart the IDE.

  --------------------------------------------------

  To avoid most of the resolution problems of Sikuli, I chnage within my script the user windows desktop resolution (100% - 125% - 150% and 175%) and i put it by default at 125%. The thing is that Sikuli is only looking in the old resolution (for example, if i go from 150% to 125%, a large part of the bottom and right side of the screen won't be detected, so if I need to find() something here, it will never be able to). I don't know if it is fixable but i might just post it here.
  I am using version 2.0.5 under windows 10 64 bits.
  Tried it on Java 8 and Java 17, both have the same problem.
  If you want to reproduce the bug, just make a script which changes windows resolution, then try to find something like the Wi-Fi logo on the bottom rigt part of the screen. You can also open SikuliIDE while being at 150% or 175%, then switch back to 125% and take a screenshot with the IDE tool made for it, you will se the part of the screen that is ignored.
  I know that relaunching SikuliIDE fixes it, but it is in the case that it is needed to switch it inside the script, for portability between different persons laptops.

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/2007980/+subscriptions



References