Not sure about getting an arbitrary pixel regardless of what lies
underneath the cursor, but if your looking to eye-drop an image within a Qt
interface (which may be what the Render View is doing, I'm not sure), you
can get the cursor position with
QCursor.pos()<http://qt-project.org/doc/qt-5/qcursor.html#pos>and use
that to determine a color within an image using
QImage.pixel() <http://qt-project.org/doc/qt-4.8/qimage.html#pixel>

# Psuedo-code
current_position = QCursor.pos()
widget_under_cursor = QApplication.widgetAt(current_position)
relative_position = widget_under_cursor.mapFromGlobal(current_position)
color = my_image.pixel(relative_position)  # Returns a QRgb object


On 7 April 2014 16:20, Arvid Schneider <[email protected]> wrote:

> Hey Group,
>
> I am trying to return rgb/float values at the current pixel under the
> mouse pointer. How would you accomplish that?
> The idea is, to press a button which enables the getColor method, so when
> I hover the mouse over mayas viewport (render view) and click MMB a
> rgb/float value is returned.
> I couldnt find a way yet using Qt or python.
> Maybe someone has an idea.
> Arvid
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/f31df7eb-d1af-4c40-8bc7-bc5e062c5553%40googlegroups.com<https://groups.google.com/d/msgid/python_inside_maya/f31df7eb-d1af-4c40-8bc7-bc5e062c5553%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Marcus Ottosson*
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAgR8Au7%2BhjnfYHHX4nWVfWkraZubrKon57_ywvWmmiiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to