How to make gl.GLBarGraphItem.setColor() work?

69 views
Skip to first unread message

Jiri Ch

unread,
May 24, 2018, 5:21:21 AM5/24/18
to pyqtgraph
Hi,

I try to create stacked 3d bar graph using gl.GLBarGraphItem. For that I need to loop through layers and paint each one in a different way. For some reason this does not work:

bg = gl.GLBarGraphItem(pos, size)
arg = 'r'
bg.setColor(arg)

I tried various values to be put inside setColor function but with no success. It always returns following error:

    |==============================>>
    |  Traceback (most recent call last):
    |    File "<string>", line 1, in <module>
    |    File "C:\Users\chroustovskyj\AppData\Local\Programs\Python\Python36\lib\idlelib\run.py", line 142, in main
    |      ret = method(*args, **kwargs)
    |    File "C:\Users\chroustovskyj\AppData\Local\Programs\Python\Python36\lib\idlelib\run.py", line 457, in runcode
    |      exec(code, self.locals)
    |    File "C:\Users\chroustovskyj\Desktop\Dev_py\New_App\PYQTgraph\PYQTgraph_1.08.py", line 46, in <module>
    |      QtGui.QApplication.instance().exec_()
    |    File "C:\Users\chroustovskyj\AppData\Local\Programs\Python\Python36\lib\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 179, in paintGL
    |      self.drawItemTree(useItemNames=useItemNames)
    |    File "C:\Users\chroustovskyj\AppData\Local\Programs\Python\Python36\lib\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 219, in drawItemTree
    |      self.drawItemTree(i, useItemNames=useItemNames)
    |    File "C:\Users\chroustovskyj\AppData\Local\Programs\Python\Python36\lib\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 200, in drawItemTree
    |      debug.printExc()
    |    --- exception caught here ---
    |    File "C:\Users\chroustovskyj\AppData\Local\Programs\Python\Python36\lib\site-packages\pyqtgraph\opengl\GLViewWidget.py", line 197, in drawItemTree
    |      i.paint()
    |    File "C:\Users\chroustovskyj\AppData\Local\Programs\Python\Python36\lib\site-packages\pyqtgraph\opengl\items\GLMeshItem.py", line 186, in paint
    |      glColor4f(*color)
    |  TypeError: this function takes 4 arguments (3 given)
    |==============================<<
Error while drawing item <pyqtgraph.opengl.items.GLBarGraphItem.GLBarGraphItem object at 0x0000017541A519C8>.

Any tip how to get over this problem? Thanks!
Reply all
Reply to author
Forward
0 new messages