# Adding Rulers to Python Code

**URL:** <https://discourse.slicer.org/t/adding-rulers-to-python-code/13802>\
**Category:** Support\
**Tags:** python, annotations, markups\
**Created:** [October 1, 2020, 5:08pm UTC](https://discourse.slicer.org/t/adding-rulers-to-python-code/13802 "2020-10-01T17:08:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kleingeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kleingeo/32/6772_2.png) [@kleingeo](https://discourse.slicer.org/u/kleingeo)\
**Post date:** [October 1, 2020, 5:08pm UTC](https://discourse.slicer.org/t/adding-rulers-to-python-code/13802/1 "2020-10-01T17:08:47Z")

</div>

I am currently working on a plugin for people not familiar with Slicer to use, so I am trying to keep the plugin self-contained. I am trying to add functionality for the user to add rulers for it for later measurements. What is the best way to do this? The only thing I’ve had some success with so far is using `markerTable = slicer.qSlicerSimpleMarkupsWidget()` but it only supports fiducial markers rather than rulers.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 2, 2020, 11:43pm UTC](https://discourse.slicer.org/t/adding-rulers-to-python-code/13802/2 "2020-10-02T23:43:35Z")

</div>

> [@kleingeo](#):
>
> I am currently working on a plugin for people not familiar with Slicer to use, so I am trying to keep the plugin self-contained.

Very good.

> [@kleingeo](#):
>
> The only thing I’ve had some success with so far is using `markerTable = slicer.qSlicerSimpleMarkupsWidget()` but it only supports fiducial markers rather than rulers.

By default, `qSlicerSimpleMarkupsWidget`’s node selector shows fiducial nodes, but you can [get the node selector combobox](http://apidocs.slicer.org/master/classqSlicerSimpleMarkupsWidget.html#a22ad5ec34cc62da601554176a8d4f3ba) and [set node types](http://apidocs.slicer.org/master/classqMRMLNodeComboBox.html#a167e0d372b20a5ec1cbea308c3b4b6ae) (class names) that you want to work with.

> [@kleingeo](#):
>
> I am trying to add functionality for the user to add rulers for it for later measurements. What is the best way to do this?

If you just want to place a line (not display point coordinates) then it is probably better to use simpler and more compact [markups place widget](http://apidocs.slicer.org/master/classqSlicerMarkupsPlaceWidget.html).
