# How to hide the purple cube in 3D view using Python scripting?

**URL:** <https://discourse.slicer.org/t/how-to-hide-the-purple-cube-in-3d-view-using-python-scripting/29734>\
**Category:** Development\
**Created:** [May 29, 2023, 10:24am UTC](https://discourse.slicer.org/t/how-to-hide-the-purple-cube-in-3d-view-using-python-scripting/29734 "2023-05-29T10:24:48Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [May 30, 2023, 11:24am UTC](https://discourse.slicer.org/t/how-to-hide-the-purple-cube-in-3d-view-using-python-scripting/29734/4 "2023-05-30T11:24:39Z")

</div>

With some searching in the forum you can usually find existing solutions that can help directly or indirectly with finding what you need.

For example see this post that mentions about the box in the 3D view.

> [@Change color box within 3D view](https://discourse.slicer.org/t/change-color-box-within-3d-view/24350):
>
> Hi, [The issue already been asked](https://discourse.slicer.org/t/how-to-change-color-of-3d-cube-inside-3d-view/769/10) but still I’m trying to struggle with this. The idea is to modify the color of the cube from 3D view when the view is created within SlicerCAT. To solve this I need to understand how to get this cube as VTK or MRML object. Who is responsible for creating it? For example I can see that [vtkMRMLViewNode](https://github.com/Slicer/Slicer/blob/115e32bdf8e478208fc2c75179cf2ecdb555d984/Libs/MRML/Core/vtkMRMLViewNode.h#L318) has BoxVisible attribute. To modify visibility one simply triggers this attribute: viewNode = slicer.app.layoutManager().threeDWidget(0).mrmlViewNode() viewNod…

Also consult the Slicer script repository for examples of common tasks that can help guide you even if it is not exactly what you desire. For example here is how to change the box color, but changing box visibility could be inferred from that example.

[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#change-box-color-in-3d-view](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#change-box-color-in-3d-view)

---

_[View the full topic](https://discourse.slicer.org/t/how-to-hide-the-purple-cube-in-3d-view-using-python-scripting/29734)._
