By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,799 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,799 IT Pros & Developers. It's quick & easy.

pixel colour on screen

P: n/a
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
Jun 28 '08 #1
Share this Question
Share on Google+
4 Replies

P: n/a

Dennis Lee Bieber wrote:
On Sat, 28 Jun 2008 11:47:46 -0700 (PDT), cj*******@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
Jun 29 '08 #2

P: n/a
cj*******@hotmail.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, ti**@probo.com
Providenza & Boekelheide, Inc.
Jun 30 '08 #3

P: n/a
On Jun 30, 4:37*am, Tim Roberts <t...@probo.comwrote:
cjstut...@hotmail.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 wholescreenoutput 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?
Jul 26 '08 #4

P: n/a
chris <cj*******@hotmail.comwrote:
>On Jun 30, 4:37*am, Tim Roberts <t...@probo.comwrote:
>cjstut...@hotmail.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 wholescreenoutput 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, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.