Sanitize input for plotItem.showGrid (was documentation fix for plotItem.showGrid alpha setting) (#1809)

* documentation fix for plotItem.showGrid alpha setting

* revert to 0-1 scale
This commit is contained in:
Nils Nemitz 2021-06-02 14:43:58 +09:00 committed by GitHub
parent 0da1958ff1
commit 39f705fd7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -373,8 +373,8 @@ class PlotItem(GraphicsWidget):
if y is not None:
self.ctrl.yGridCheck.setChecked(y)
if alpha is not None:
v = fn.clip_scalar(alpha, 0., 1.)*self.ctrl.gridAlphaSlider.maximum()
self.ctrl.gridAlphaSlider.setValue(v)
v = fn.clip_scalar(alpha, 0, 1) * self.ctrl.gridAlphaSlider.maximum() # slider range 0 to 255
self.ctrl.gridAlphaSlider.setValue( int(v) )
def close(self):
## Most of this crap is needed to avoid PySide trouble.