from PyQt5 import Qt
from PyQt5.QtGui import QColor
from pyqtgraph.opengl import GLViewWidget


class GLView(GLViewWidget):
    """
    I have implemented my own GLViewWidget
    """
    def __init__(self, parent=None):
        super().__init__(parent)

    def mouseReleaseEvent(self, ev):
        region = (ev.pos().x() - 5, ev.pos().y() - 5, 10, 10)
        print(self.itemsAt(region))

    def paintGL(self, *args, **kwds):
        GLViewWidget.paintGL(self, *args, **kwds)
        self.qglColor(QColor("k"))
        self.renderText(0, 0, 0, 'text')



Am Donnerstag, 2. Juni 2016 11:53:21 UTC+2 schrieb Muneeb Imran:
>
> Hello Luke,
>
> Could you please tell me the format or datatype used for qglColor. I am 
> having issue passing any color. Or could you may be still have this working 
> file, It would be helpful.
>
> On Thursday, 4 September 2014 21:32:11 UTC+2, Luke Campagnola wrote:
>>
>> On Thu, Sep 4, 2014 at 3:05 PM, Miha Pirnat <[email protected]> wrote:
>>
>>> Hello, 
>>>
>>> would it be possible to use renderText in this way:
>>>
>>> import pyqtgraph.opengl as gl
>>> import pyqtgraph as pg
>>> import PySide.QtCore as pqc
>>> import PySide.QtGui as pqg
>>>
>>> app = pqg.QApplication([])
>>> w = gl.GLViewWidget()
>>>
>>> w.show()
>>>
>>> g = gl.GLGridItem()
>>> w.addItem(g)
>>>
>>> w.qglColor(pqc.Qt.white)
>>> w.renderText(0.,0.,0.,'text')
>>>
>>
>> This should work if you make a subclass of GLViewWidget that calls 
>> renderText from inside its paintGL method:
>>
>> class MyGLView(GLViewWidget):
>>     def paintGL(self, *args, **kwds):
>>         GLViewWidget.paintGL(self, *args, **kwds)
>>         self.qglColor(Qt.white)
>>         self.renderText(0, 0, 0, 'text')
>>
>

-- 
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/d9b8273d-6d46-4a0c-b87b-657a4dab42a0%40googlegroups.com.

Reply via email to