I'm looking for the same thing (text / label rendering at 3D space) but I'm
sorry it's not enough information here (in terms of implementation) to
understand how to actually implement this feature.
For example I have this (one line plotting at 3D space), how to add a label
near by it.
code sample:
import numpy as np
import pyqtgraph.opengl as gl
from pyqtgraph.Qt import QtWidgets
from pyqtgraph import Vector
class plot3D(object):
def __init__(self):
self.line_input = 0
self.app = QtWidgets.QApplication(sys.argv)
self.w = gl.GLViewWidget()
axis = gl.GLAxisItem()
self.w.addItem(axis)
def plot_line(self):
pl_line = np.array([(338.12, 508.03, 0.0), (338.12, 0.0, 0.0)])
color = (250, 0, 0, 0.7)
newline = gl.GLLinePlotItem(pos=pl_line, color=color, width=2,
antialias=False)
self.w.addItem(newline)
self.w.show()
def exec(self):
self.app.exec()
pl3d = plot3D()
pl3d.plot_line()
pl3d.exec()
On Friday, August 16, 2019 at 4:16:58 AM UTC-7, Maher Albezem wrote:
>
> 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/7fef3346-b8aa-416a-9fbb-aedf5326a14a%40googlegroups.com.