← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #200257]: Getting Monitor Specs rates

 

Question #200257 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/200257

Tim Tindell posted a new comment:
So I didn't use Robot. That didn't seem to have what I wanted. I used
DisplayMode,GraphicsDevice, and GraphicsEnvironment to get the job done.
I wrote it in a definition to be called later. Take a look:

import java.awt.DisplayMode, java.awt.GraphicsDevice, java.awt.GraphicsEnvironment
def getPrimDispAndRef():
    ge=java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment( )
    gs=[ ]
    scr=[ ]
    ref=[ ]
    gs =ge.getScreenDevices()
    a=java.awt.DisplayMode
    for x in range(len(gs)):
        gd=gs[x]
        gw=gd.getIDstring()
        #print gw
        prefix, number = gw.split('y')
        #print number
        d=gd.getDisplayMode()
        num=d.getRefreshRate()
        ref.append(num)
        #print ref
        if number=="0":
            Disp="Primary"
            scr.append(Disp)
        else:
            Disp="Secondary"
            scr.append(Disp)
        print scr[x] + " screen is running at " + repr(ref[x]) + " hz"
    return scr,ref
#It returns two arrays with the displays in one, and the refresh rate in the other.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.