← Back to team overview

sikuli-driver team mailing list archive

[Bug 1384494] Re: [1.1.0] screen.capture only Screen(0) in multi-monitor

 

** Summary changed:

- [1.1.0 Beta] screen.capture only Screen(0) in multi-monitor
+ [1.1.0] screen.capture only Screen(0) in multi-monitor

** Changed in: sikuli
       Status: In Progress => Fix Committed

** Changed in: sikuli
   Importance: High => Critical

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

Title:
  [1.1.0] screen.capture only Screen(0) in multi-monitor

Status in Sikuli:
  Fix Committed

Bug description:
  ************ this works with version 1.1.0

  scrs = []
  dir = getBundlePath()
  for n in range(getNumberScreens()):
    scrs.append(Screen(n).getScreen()) # to get the Java level object
  for scr in scrs:
    filename = "screen%d" % scr.getID()
    scr.capture().getFile(dir, filename)

  captures of the screens are saved to the bundle as screenN.png
  -------------------------------------------

  Sikuli version: 1.1.0-Beta2

  I want to capture each screen separately every 2 seconds and wrote the
  following code to achieve it:

  import os
  import shutil

  import datetime

  screenshotsDir = r"C:\Users\Sikuli\Temp\Exceptions"

  screens = [Screen(id) for id in range(Screen().getNumberScreens())]

  print screens # Prints [S(0)[0,0 1920x1080] E:Y, T:3.0, S(1)[-1920,0 1920x1080] E:Y, T:3.0]
  print Screen().getNumberScreens() # Prints 2

  while True:
      for _dx, screen in enumerate(screens):
          print screen.getBounds() # Prints java.awt.Rectangle[x=0,y=0,width=1920,height=1080] and java.awt.Rectangle[x=-1920,y=0,width=1920,height=1080] respectively

          img = screen.capture(screen.getBounds())
          time_now = datetime.datetime.now().strftime("%H%M%S")
          img_target = "{}.S{}.png".format(time_now, _dx)

          target = os.path.join(screenshotsDir, img_target)
          shutil.move(img, target)

      time.sleep(2)

  Unfortunately, when I go and check the screenshots, I see that Sikuli
  only grabbed S(0) for both monitors although the code print output
  gives all the right information!

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


References