you can use this in a python script and access it by using eg.DesktopDisplay
eg.DesktopDisplay has the following methods (things you can call to get data)
eg.DesktopDisplay.Refresh() - refreshes the display list. this automatically gets called when EnumDisplays() or GetDisplay() is called.
eg.DesktopDisplay.EnumDisplays() - enumerates the displays, creates a list of eg.DesktopDisplay.Display instances each instance represents a currently attached display
eg.DesktopDisplay.GetDisplay() - you can either pass this the monitor number or monitor name and this will retrun a DesktopDisplay.Display instance, The display number and display name can be found in the windows Screen Resolution dialog. NOTE if using the display number you will need to make it one digit lower then what is displayed in the Screen Resolution dialog so display 1 you would pass a 0 to this method
attributes
eg.DesktopDisplay.displays - this is a list of all of the available displays that are attached
eg.DesktopDisplay.size - this is the virtual size of the desktop display, so if you have 4 displays 3 horizontal and the 4th is above the center display. this would return the total width and total height. even tho you do not have a display for 2 spots it will report a resolution of them being there.
eg.DesktopDisplay.displayCount - number of connected displays
eg.DesktopDisplay.isTouchScreen - take a guess (True/False)
eg.DesktopDisplay.isMultiTouch - take a guess (True/False)
eg.DesktopDisplay.maxTouchCount - maximum number of simultaneous touches if the display is touch capable otherwise 0
eg.DesktopDisplay.Display:
this class will be returned as a representation of a specific display that is attached.
attributes:
Display.blackout - set True/False to blackout the display or to check if it has been set (example code below)
Display.x - upper left corner of the display pixel position relative to the top left corner of the primary display
Display.y - upper left corner of the display pixel position relative to the top left corner of the primary display
Display.w - display pixel resolution width
Display.h - display pixel resolution height
Display.primary - True/False if the display is the primary display
Display.number - display number, this the the number seen in the windows screen resolution dialog
Display.name - name of the display. this is the name seen in the screen resolution dialog
Display.size - this is the size of the display returned as (w, h)
Display.pos - this is the upper left corner pixel position of the display returned as (x, y)
If for example you have 3 displays attached and you disconnect display #2 this will automatically cause Windows to reorder the displays this will also reorder as required.
OK so here is a rundown of the blackout.
Since there is no mechanism in Windows to be able to turn off a single display in a multi display setup I decided to make something that will help a little. this will black out a display. you will still get a glow form the screen. but it is better then nothing.
to blackout a display you would replace the 0 with the display number you wanted to black out.
Code: Select all
display = eg.DesktopDisplay.GetDisplay(0)
if not display.blackout:
display.blackout = True
Code: Select all
display = eg.DesktopDisplay.GetDisplay('HP w2007 Wide LCD Monitor')
if not display.blackout:
display.blackout = True
Name: HP w2007 Wide LCD Monitor, 'Number: 0, Width: 1920, Height: 1080, X: 0, Y: 0, Primary: True
Code: Select all
display = eg.DesktopDisplay.GetDisplay(0)
print display
Code: Select all
display = eg.DesktopDisplay.GetDisplay(0)
print str(display).replace(', ', '\n')
if you power off or unplug a display while the screen is blacked out it should disable the blackout.
If you change the display position when the screen is blacked out, the blackout should remain and follow the screen to it's new location.

