-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
my Story
Passing ROI class and adding Scale handles, due to the nature of the background colors and data plotted below the active ROI, the default scale handle is not really visible so tried to increase width of line and change color, by setting self.handlePen = {'color': (150,75,255), 'width': 5} in the custom class calling the pyqtgraph.ROI I am able to change the default color used by mkPen when creating the Handle, but the width of the line is not changing...
I noticed the example used in the mkPen docstring is throwing an error (NameError: name 'width' is not defined) so changed only width: 5 to 'width': 5
I tested out as well passing directly a Handle as item object into assScaleHandle, but no success], color works, but width nope again, I even tested a dash and it worked...
It seems like mkPen is not reading properly the width keyword argument I am passing, or it is not really passing it properly to QPen??? I'm kind of lost here, unless something somewhere else is replacing the width being used by the Handle.
Class using pg.ROI, with handlePen set as dictionary Try#1:
import pyqtgraph as pg
import numpy as np
class EventRoi(pg.ROI):
def __init__(self, pos, size, custom_format, mainApp=None, *args, **kwargs):
super().__init__(pos, size, *args, **kwargs)
self.mainApp = mainApp
self.handlePen = {'color': (255, 255, 0),'width': 4}Function using myROI with Handle class passed as item when adding scaleHandle try#2:
def add_roi(self, x0, x1, y0, y1, format = {}, is_restored_event=False, ignoreBounds=True):
roi = EventRoi(
[x0, y0],
[x1-x0, y1-y0],
custom_format=format,
mainApp=self)
roi.addScaleHandle([1, 0.5],
[0, 0.5],
item=pg.graphicsItems.ROI.Handle(roi.handleSize,
typ='s',
pen=pg.functions.mkPen(color=(255, 255, 0, 255), width=4, dash= [1,1]),
hoverPen=roi.handleHoverPen,
parent=roi))Expected behavior
Handles with wider lines and set color
Real behavior
Handles have set color, and in the second try even the correct dashing, but line is still default width, this is the same for both versions mentioned above.
No errors occurred during runtime.
Tested environment(s)
- PyQtGraph version: 0.13.3
- Qt Python binding: 'PyQt5 5.15.7 Qt 5.15.2'
- Python version: 3.10.8
- NumPy version: 1.24..3
- Operating system: Windows
- Installation method: conda install