Skip to content

Commit

Permalink
image_2d: hide z cursor label by setting to empty string
Browse files Browse the repository at this point in the history
set_visible(False) didn't work (on Windows, at least).
  • Loading branch information
pmldrmota committed May 8, 2024
1 parent 2620f67 commit 8f5ebb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ndscan/plots/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def set_value(self, value: float, limits: tuple[float, float]):
text = "{0:.{n}f}{1}".format(value * self.data_to_display_scale,
self.unit_suffix,
n=precision)
self.set_text(text)

def set_text(self, text):
for label in self.text_items:
label.setText(text)

Expand Down
2 changes: 1 addition & 1 deletion ndscan/plots/image_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def update_coords(self, data_coords):
if (0 <= x_idx < shape[0]) and (0 <= y_idx < shape[1]):
z = self.image_data[x_idx, y_idx]
if np.isnan(z):
self.set_visible(False)
self.set_text("")
else:
self.set_value(z, self.z_limits)

Expand Down

0 comments on commit 8f5ebb3

Please sign in to comment.