# How to toggle the button of "orthobutton" via python

**URL:** <https://discourse.slicer.org/t/how-to-toggle-the-button-of-orthobutton-via-python/15830>\
**Category:** Support\
**Created:** [February 4, 2021, 7:18am UTC](https://discourse.slicer.org/t/how-to-toggle-the-button-of-orthobutton-via-python/15830 "2021-02-04T07:18:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aiden.zhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aiden.zhu/32/67145_2.png) [@aiden.zhu](https://discourse.slicer.org/u/aiden.zhu)\
**Post date:** [February 4, 2021, 7:18am UTC](https://discourse.slicer.org/t/how-to-toggle-the-button-of-orthobutton-via-python/15830/1 "2021-02-04T07:18:24Z")

</div>

Operating system: windows  
Slicer version: 4.11.0-2019-06-23 r28335  
Expected behavior:  
Actual behavior:

Hi all,  
What’s the sub-function to control the orthobutton to toggle here?  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/6/862db834ff60eea85a7659fbaccb4666c768b08c.png)  
Thanks a lot.  
Aiden

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [February 4, 2021, 7:27am UTC](https://discourse.slicer.org/t/how-to-toggle-the-button-of-orthobutton-via-python/15830/2 "2021-02-04T07:27:17Z")

</div>

To update the rendering mode associated with the first 3D viewer:

```python
viewNode = slicer.util.getNode('vtkMRMLViewNode1')

# Switch to orthographic
viewNode.SetRenderMode(slicer.vtkMRMLViewNode.Orthographic)

# Switch to perspective
viewNode.SetRenderMode(slicer.vtkMRMLViewNode.Perspective)

```

---

<div class="post-metadata">

**Author:** ![aiden.zhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aiden.zhu/32/67145_2.png) [@aiden.zhu](https://discourse.slicer.org/u/aiden.zhu)\
**Post date:** [February 4, 2021, 7:30am UTC](https://discourse.slicer.org/t/how-to-toggle-the-button-of-orthobutton-via-python/15830/3 "2021-02-04T07:30:09Z")

</div>

> [@jcfr](#):
>
> `viewNode.SetRenderMode(slicer.vtkMRMLViewNode.Perspective)`

@jcfr Really appreciate your quick answer! Thanks you very much!
