Lefthand v righthand?

28 views
Skip to first unread message

ron

unread,
May 31, 2017, 7:59:12 AM5/31/17
to pyqtgraph
Is the pyqtgraph GLViewWidget() inherently a left handed or right handed coordinate system? Is there a way to set this?

The code below is just enough to show the GLAxisItem. It looks like a lefty!

Is there a way to change the setup to a right-handed coordinate system?

import pyqtgraph.opengl as gl
import pyqtgraph as pg
import PySide
app = PySide.QtGui.QApplication([])
fig = gl.GLViewWidget()
axis = gl.GLAxisItem()
fig.addItem(axis)
fig.setWindowTitle('left v right')
fig.show()
pg.QtGui.QApplication.instance().exec_()

vas...@gmail.com

unread,
May 31, 2017, 12:53:43 PM5/31/17
to pyqt...@googlegroups.com
I am sure there is an another way, but you can override GlViewWidget mouseMoveEvent method (original code is commented out).


import pyqtgraph.opengl as gl
import pyqtgraph as pg
from pyqtgraph import QtCore

class GLViewWidgetLeftHanded(gl.GLViewWidget):
    def __init__(self):
        super(GLViewWidgetLeftHanded, self).__init__()
       
    def mouseMoveEvent(self, ev):
        diff = ev.pos() - self.mousePos
        self.mousePos = ev.pos()
       
        # if ev.buttons() == QtCore.Qt.LeftButton:
        if ev.buttons() == QtCore.Qt.RightButton:
            self.orbit(-diff.x(), diff.y())
        elif ev.buttons() == QtCore.Qt.MidButton:
            if (ev.modifiers() & QtCore.Qt.ControlModifier):
                self.pan(diff.x(), 0, diff.y(), relative=True)
            else:
                self.pan(diff.x(), diff.y(), 0, relative=True)

app = pg.QtGui.QApplication([])
fig = GLViewWidgetLeftHanded()

axis = gl.GLAxisItem()

fig.addItem(axis)
fig.setWindowTitle('left v right')
fig.show()
pg.QtGui.QApplication.instance().exec_()

--
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 pyqtgraph+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/cbeb8a31-91eb-473b-8320-9b1d3382d5f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages