pixel colour on screen

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cjstuttle@hotmail.com

    pixel colour on screen

    Could anyone help me, I'm a python noob and need some help. im trying
    to find some code that will, given a screen co-ordinate, will give me
    the colour of that pixel in RGB. i have found a lot about getting the
    pixel colour from a picture file with a given co-ordinate, but is it
    possible to do it from the whole screen output regardless what
    application the selected pixel is in?

    any help would be help.

    thanks, Chris
  • Irmen de Jong

    #2
    Re: pixel colour on screen


    Dennis Lee Bieber wrote:
    On Sat, 28 Jun 2008 11:47:46 -0700 (PDT), cjstuttle@hotma il.com
    declaimed the following in comp.lang.pytho n:
    >
    >Could anyone help me, I'm a python noob and need some help. im trying
    >to find some code that will, given a screen co-ordinate, will give me
    >the colour of that pixel in RGB. i have found a lot about getting the
    >pixel colour from a picture file with a given co-ordinate, but is it
    >possible to do it from the whole screen output regardless what
    >application the selected pixel is in?
    >>
    Such capability differs with OS and GUI libraries. If one is lucky,
    the GUI library will accept any screen coordinate -- but it is just as
    likely that the OS could limit a program to only coordinates within its
    own window.
    Maybe the easiest way is to create a screenshot of the whole screen
    (that should be doable from within a program, although this differs for every OS and GUI
    lib as well) and then get the pixel value from that.

    --irmen

    Comment

    • Tim Roberts

      #3
      Re: pixel colour on screen

      cjstuttle@hotma il.com wrote:
      >
      >Could anyone help me, I'm a python noob and need some help. im trying
      >to find some code that will, given a screen co-ordinate, will give me
      >the colour of that pixel in RGB. i have found a lot about getting the
      >pixel colour from a picture file with a given co-ordinate, but is it
      >possible to do it from the whole screen output regardless what
      >application the selected pixel is in?
      Which operating system? If you are on Windows, and you have pywin32
      loaded. you can use the Windows APIs GetDC and GetPixel.
      --
      Tim Roberts, timr@probo.com
      Providenza & Boekelheide, Inc.

      Comment

      • chris

        #4
        Re: pixel colour on screen

        On Jun 30, 4:37 am, Tim Roberts <t...@probo.com wrote:
        cjstut...@hotma il.com wrote:
        >
        Could anyone help me, I'm a python noob and need some help. im trying
        to find some code that will, given ascreenco-ordinate, will give me
        thecolourof thatpixelin RGB. i have found a lot about getting the
        pixelcolourfrom a picture file with a given co-ordinate, but is it
        possible to do it from the wholescreenoutp ut regardless what
        application the selectedpixelis in?
        >
        Which operating system?  If you are on Windows, and you have pywin32
        loaded. you can use the Windows APIs GetDC and GetPixel.
        --
        Tim Roberts, t...@probo.com
        Providenza & Boekelheide, Inc.
        i have ubuntu hardy. does that help?

        Comment

        • Tim Roberts

          #5
          Re: pixel colour on screen

          chris <cjstuttle@hotm ail.comwrote:
          >On Jun 30, 4:37 am, Tim Roberts <t...@probo.com wrote:
          >cjstut...@hotm ail.com wrote:
          >>
          >Could anyone help me, I'm a python noob and need some help. im trying
          >to find some code that will, given ascreenco-ordinate, will give me
          >thecolourof thatpixelin RGB. i have found a lot about getting the
          >pixelcolourfro m a picture file with a given co-ordinate, but is it
          >possible to do it from the wholescreenoutp ut regardless what
          >application the selectedpixelis in?
          >>
          >Which operating system?  If you are on Windows, and you have pywin32
          >loaded. you can use the Windows APIs GetDC and GetPixel.
          >
          >i have ubuntu hardy. does that help?
          Then you will have to use a GUI library of some kind: wx, or Qt, or
          tkinter. The answer depends on which GUI library you decide to use.
          --
          Tim Roberts, timr@probo.com
          Providenza & Boekelheide, Inc.

          Comment

          Working...