Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Content of mss().monitors does not correspond with secondary screen resolution, cannot take screenshots (Windows 8.1)

See original GitHub issue

General informations:

  • OS name: Windows
  • OS version: 8.1
  • OS architecture: 64 bits
  • Monitor(s)'s resolution: Monitor 1: 1600x900 ; Monitor 2: 1920x1080
  • Result of the command python --version: Python 2.7.9

Description of the warning/error

The content of mss().monitors is incorrect:

import mss
for monitor in mss.mss().monitors:
	print monitor


{'width': 2880, 'top': 0, 'height': 900, 'scale': 1.0, 'left': 0}
{'width': 1600, 'top': 0, 'height': 900, 'scale': 1.0, 'left': 0}
{'width': 1280, 'top': 0, 'height': 720, 'scale': 1.0, 'left': 1600}

The third line does not correspond with the secondary monitor resolution.

Full message

Here is a testing script I made:

import mss
from Tkinter import *
app = Tk()

def screenshot():
	top = btn.winfo_rooty()
	left = btn.winfo_rootx()
	width = btn.winfo_width()
	height = btn.winfo_height()
	selection = {'top': top, 'left': left, 'width': width, 'height': height}
	sct_img = mss.mss().grab(selection), sct_img.size, output="screenshot.png")

btn=Button(app, text="Grab a screenshot", command=screenshot)
btn.pack(fill=X,padx=50, pady=50)

print "Monitors:"
for monitor in mss.mss().monitors:
	print monitor


The script creates a simple Tkinter windows with a buton. A click on the buton save a screenshot of that button, using the coordinate provided by Tkinter.

This works when the windows is on the primary monitor, but does not work after I drag the windows on the secondaty monitor: the screenshot represents another part of the monitor.

Other details

When I set the secondary monitor resolution to correspond with the resolution provided by mss, then the screenshot works perfectly on both monitors.

The script works just fine on Ubuntu.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

pnprogcommented, Jan 25, 2018

Hi! It maybe also an issue with my specific installation of Windows 8.1 (maybe the drivers or something else). This is not for a critical feature, so I pushed the code “in production” anyway. I will let you know if I get similar feedback.

BoboTiGcommented, Jan 23, 2018

It will be hard for me to reproduce, I have no W8.1. The code that guesses monitors information is here, it seems legit but perhaps could you find something wrong here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dual Monitors not displaying correctly in Windows 8.1
I opened the screen resolution menu and tried to make my monitor the primary display, but the option was disabled.
Read more >
mss sct.grab won't let me select which monitor to use
It seems I can either get a partial screenshot, but not choose the monitor, or I can choose the monitor, but only get...
Read more >
Citrix Fixes and Known Issues – XenApp & XenDesktop ...
Users are unable to launch published applications intermittently with no error being displayed to the user. Citrix Studio also shows an active ...
Read more >
Snagit Changes Screen Resolution - Can't Capture Parts of a ...
I use Snagit 2018 on a laptop connected with an external monitor.Of late when I try to capture a screenshot, Snagit lowers the...
Read more >
does not fit into your outlet, consult an electrician for replacement of the obsolete ... What is shown in the manual's illustrations and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found