pixel colour on screen

Irmen de Jong irmen.NOSPAM at xs4all.nl
Sun Jun 29 13:43:34 CEST 2008


Dennis Lee Bieber wrote:
> On Sat, 28 Jun 2008 11:47:46 -0700 (PDT), cjstuttle at hotmail.com
> declaimed the following in comp.lang.python:
> 
>> 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



More information about the Python-list mailing list