# Show scalar bar programmatically

**URL:** <https://discourse.slicer.org/t/show-scalar-bar-programmatically/9842>\
**Category:** Support\
**Created:** [January 16, 2020, 9:03pm UTC](https://discourse.slicer.org/t/show-scalar-bar-programmatically/9842 "2020-01-16T21:03:24Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [January 17, 2020, 7:22pm UTC](https://discourse.slicer.org/t/show-scalar-bar-programmatically/9842/9 "2020-01-17T19:22:21Z")

</div>

> [@pieper](#):
>
> qt.QSettings().setValue(‘DataProbe/sliceViewAnnotations.scalarBarEnabled’, True) import DataProbeLib DataProbeLib.SliceAnnotations().updateSliceViewFromGUI()

Update: the argument to `setValue` here needs to be an int not a boolean in order to be restored correctly:

```auto
qt.QSettings().setValue('DataProbe/sliceViewAnnotations.scalarBarEnabled', 1)
import DataProbeLib
DataProbeLib.SliceAnnotations().updateSliceViewFromGUI()

```

---

_[View the full topic](https://discourse.slicer.org/t/show-scalar-bar-programmatically/9842)._
