def __init__(self, pos, angle, pen=QtGui.QPen(QtGui.QColor('#FFFF00'), 5),
movable=True):
pg.InfiniteLine.__init__(self, pos, angle, pen=pen, movable=True)
def setMouseHover(self, hover):
pass
########
app = pg.mkQApp()
pw = pg.GraphicsLayoutWidget()
pw.show()
w1 = pw.addPlot()
a = MyLine(50 , 90, pen = pen)
w1.addItem(a)
app.exec_()
I am setting the width of InfiniteLine by setting the width of the pen. But on mousehover on InfiniteLine the width changes and the line becomes thin. I checked in the InfineLine .py file to understand this behavior and found out that on mouse hover the pen is changed to mkPen(255, 0,0) and hence the width changes to default value.I want to know is there any specific reasion to set pen without considering the pen width provided as input or is it a bug.
On Friday, May 9, 2014 3:17:04 PM UTC+5:30, Manish wrote:Hi,I am setting the width of InfiniteLine by setting the width of the pen. But on mousehover on InfiniteLine the width changes and the line becomes thin. I checked in the InfineLine .py file to understand this behavior and found out that on mouse hover the pen is changed to mkPen(255, 0,0) and hence the width changes to default value.I want to know is there any specific reasion to set pen without considering the pen width provided as input or is it a bug.I made a custom class which inherits from the the InfinteLine and have overridden the setMouseHover method to do nothing on mousehover and then I have set the width of InfiniteLine.But I am facing following issues now.1. On zooming in and out the width of InfiniteLine increases and decreases.
2. On moving it in a zoomed stage it moves only when the mouse is perfectly at it's center. Some times the line spread on the plot while moving.