pyqt/python-qt5

stateChanged is not being called when moving PolyLineROI

TammeWollweber opened this issue · 1 comments

I tried to print the new coordinates of the handles of a PolyLineROI when I drag it to a new positions.
The signal sigRegionChangeFinished signal is emitted but the stateChanged function is not called such that the positions of the handles are not updated:

self.grid_box = pg.PolyLineROI(pos, closed=True, movable=True)
self.grid_box.sigRegionChangeFinished.connect(self._print_points)
self.refine_btn.setEnabled(True)
def _print_points(self):
     points_obj = self.grid_box.getState()['points']
     points = np.array([list((point[0], point[1])) for point in points_obj])
     print('Points: \n', points)

Points:
[[2127.82468485 34.86386885]
[2472.39864298 412.93394575]
[ 552.62944768 469.88173976]
[ 257.28034072 106.04861136]]
Points:
[[2127.82468485 34.86386885]
[2472.39864298 412.93394575]
[ 552.62944768 469.88173976]
[ 257.28034072 106.04861136]]

If I move each handle independently the positions are updated correctly...

When this function is called manually, it raises Recursion Error:
RecursionError: maximum recursion depth exceeded while calling a Python object