# How to modify the handle shape and color of vtkAngleWidget ?

**URL:** https://discourse.vtk.org/t/how-to-modify-the-handle-shape-and-color-of-vtkanglewidget/13248
**Category:** Web
**Created:** [February 4, 2024, 6:51am UTC](https://discourse.vtk.org/t/how-to-modify-the-handle-shape-and-color-of-vtkanglewidget/13248 "2024-02-04T06:51:16Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![sheonny](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sheonny/32/8482_2.png) [@sheonny](https://discourse.vtk.org/u/sheonny)
#### Post date: [February 4, 2024, 6:51am UTC](https://discourse.vtk.org/t/how-to-modify-the-handle-shape-and-color-of-vtkanglewidget/13248/1 "2024-02-04T06:51:16Z")

</div>

How to modify the handle shape and color of vtkAngleWidget ?

---

<div class="post-metadata">

### Author: ![finetjul](https://discourse.vtk.org/user_avatar/discourse.vtk.org/finetjul/32/154_2.png) [@finetjul](https://discourse.vtk.org/u/finetjul)
#### Post date: [February 4, 2024, 9:39pm UTC](https://discourse.vtk.org/t/how-to-modify-the-handle-shape-and-color-of-vtkanglewidget/13248/2 "2024-02-04T21:39:16Z")

</div>

You need to set the color of the move handle (`widget.getWidgetState().getMoveHandle().setColor(0.5)`). If you want more control over the color, the ‘color3’ mixin should be used instead of ‘color’.

Regarding the shape, you would need to change `getRepresentationsForViewType()` to not return a `vtkSphereHandleRepresentation` but something else.

---

<div class="post-metadata">

### Author: ![sheonny](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sheonny/32/8482_2.png) [@sheonny](https://discourse.vtk.org/u/sheonny)
#### Post date: [March 1, 2024, 9:47am UTC](https://discourse.vtk.org/t/how-to-modify-the-handle-shape-and-color-of-vtkanglewidget/13248/3 "2024-03-01T09:47:46Z")

</div>

Can angleWidget now add angle tag?  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/2/2ddc826c348a1983fd1618eaae1c1d233c07573d.png)

---

<div class="post-metadata">

### Author: ![finetjul](https://discourse.vtk.org/user_avatar/discourse.vtk.org/finetjul/32/154_2.png) [@finetjul](https://discourse.vtk.org/u/finetjul)
#### Post date: [March 1, 2024, 9:54am UTC](https://discourse.vtk.org/t/how-to-modify-the-handle-shape-and-color-of-vtkanglewidget/13248/4 "2024-03-01T09:54:24Z")

</div>

I think there are 2 approaches:

- Modify CircleContextRepresentation to support an arc (and therefore modify vtkCircleSource to support an arc)
- Create an ArcContextRepresentation and a vtkArcSource (see the [C++ version here](https://vtk.org/doc/nightly/html/classvtkArcSource.html#details))

Add one of those representations to the AngleWidget.

---

<div class="post-metadata">

### Author: ![sheonny](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sheonny/32/8482_2.png) [@sheonny](https://discourse.vtk.org/u/sheonny)
#### Post date: [March 8, 2024, 5:39am UTC](https://discourse.vtk.org/t/how-to-modify-the-handle-shape-and-color-of-vtkanglewidget/13248/5 "2024-03-08T05:39:57Z")

</div>

Sorry, I am a beginner in VTK

I can’t find how to modify the return value of getRepresentationsForViewType()；  
I tried using WidgetHandle. getWidgetState(). getHandle(). setShape (“viewFinder”), but it was useful for lineWidgets and not for angleWidgets。

---

<div class="post-metadata">

### Author: ![finetjul](https://discourse.vtk.org/user_avatar/discourse.vtk.org/finetjul/32/154_2.png) [@finetjul](https://discourse.vtk.org/u/finetjul)
#### Post date: [March 8, 2024, 6:05am UTC](https://discourse.vtk.org/t/how-to-modify-the-handle-shape-and-color-of-vtkanglewidget/13248/6 "2024-03-08T06:05:16Z")

</div>

You need to: modify directly vtkAngleWidget (PR is welcome) or create a subclass to override `getRepresentationsForViewType()`
