I found how to do that. For anyone would like to know that, here it is:

There is a small bug in paintGL function in GLViewWidget.py. All you have 
to do is replacing 
*glClearColor(bgcolor.red(), bgcolor.green(), bgcolor.blue(), 1.0)*
with
*glClearColor(bgcolor.redF(), bgcolor.greenF(), bgcolor.blueF(), 1.0)*

Hope that helps!



On Wednesday, December 28, 2016 at 6:31:53 PM UTC+8, Edmon Silva wrote:
>
> Have you found any solution for that?
>
> I'm struggling to set custom RGB values for the background color 
> of pyqtgraph.opengl.GLViewWidget. Would someone provide a working example?
>
> On Monday, April 25, 2016 at 8:28:53 PM UTC+8, Jeremy Laforet wrote:
>>
>> I'm trying to use this function to get a grey background on my plots, so 
>> far with no success…
>>
>> If called with a single letter input ("k", "w", "c"…) setBackgroundColor 
>> <http://www.pyqtgraph.org/documentation/3dgraphics/glviewwidget.html#pyqtgraph.opengl.GLViewWidget.setBackgroundColor>
>>  will 
>>  behave as expected, and my plot will have a black, white or cyan… 
>> background, but not for "d", "l" or "s".
>> But if called with anything else it will produce a white background for 
>> all color specifications but black, in that case the background is indeed 
>> black.
>>
>> *print(w.opts['bgcolor'].getRgb()) *will give back the expected RGBA 
>> value, even if the displayed background is plain white instead.
>>
>> I've tried on both OSX and Linux with the same behavior.
>>
>> Is there any way to get a grey background on a GlView ?
>>
>>
>> Le samedi 8 août 2015 17:47:19 UTC+2, Luke Campagnola a écrit :
>>>
>>> Here:  
>>> http://www.pyqtgraph.org/documentation/3dgraphics/glviewwidget.html#pyqtgraph.opengl.GLViewWidget.setBackgroundColor
>>>
>>> On Tue, Aug 4, 2015 at 10:07 PM, Mathew Schwartz <[email protected]> 
>>> wrote:
>>>
>>>> I saw a post from over a year ago about background color of the 3d 
>>>> widget.  How can I change it to white, either as a method or through the 
>>>> source, as I just need to make some figures like that.
>>>>
>>>> Thanks
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "pyqtgraph" 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/pyqtgraph/95d54f89-165b-4f67-9107-dd0d39ffb99d%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/pyqtgraph/95d54f89-165b-4f67-9107-dd0d39ffb99d%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" 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/pyqtgraph/41f72f56-482b-4b9b-adae-82a4d2e67889%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to