Cyril.Liu wrote:
> *Hello All,
> I try to get a pixel color according to x,y pixel coordinates using
> this code, but it doesn't work.*
>
> >>> import win32ui
> >>> w = win32ui.FindWindow(None, "11")
> >>> dc = w.GetWindowDC()
> >>> color = dc.GetPixel(100,100)
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in <module>
> win32ui: GetPixel failed

Are you sure you have a window with the title "11", and that it still
existed by the time you called GetPixel?

Your example worked perfectly for me.  The window was the cmd session
where I was typing the commands.  The background is dark blue, which is
0x800000.

C:\Dev\fx2\sw\linux\include>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32ui
>>> w = win32ui.FindWindow( None, "VS8 Build Environment - python" )
>>> dc = w.GetWindowDC()
>>> hex(dc.GetPixel( 100,100))
'0x800000'
>>>

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to