pixel colour on screen

C

cjstuttle

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
 
I

Irmen de Jong

Dennis said:
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
 
T

Tim Roberts

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.
 
C

chris

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?
 
T

Tim Roberts

chris said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,096
Latest member
ThurmanCre

Latest Threads

Top