# How to draw a resizable circle?

**URL:** https://discourse.vtk.org/t/how-to-draw-a-resizable-circle/11575
**Category:** Support
**Tags:** code
**Created:** [May 30, 2023, 8:47am UTC](https://discourse.vtk.org/t/how-to-draw-a-resizable-circle/11575 "2023-05-30T08:47:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Manju](https://discourse.vtk.org/user_avatar/discourse.vtk.org/manju/32/7440_2.png) [@Manju](https://discourse.vtk.org/u/Manju)
#### Post date: [May 30, 2023, 8:47am UTC](https://discourse.vtk.org/t/how-to-draw-a-resizable-circle/11575/1 "2023-05-30T08:47:26Z")

</div>

I need to insert a circle into VTK widget window via mouse interaction. Its radius and position should be resizable by dragging. Inserting a polydata doesn’t seem to provide the option to modify radius and position. Could anyone suggest the right tool to do this - similar to distance widget or angle widget? Or any method to implement this. Any help would be highly appreciated.

Thanks

---

<div class="post-metadata">

### Author: ![Jishnu](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jishnu/32/6221_2.png) [@Jishnu](https://discourse.vtk.org/u/Jishnu)
#### Post date: [May 30, 2023, 12:30pm UTC](https://discourse.vtk.org/t/how-to-draw-a-resizable-circle/11575/2 "2023-05-30T12:30:09Z")

</div>

You can use the combination of line widget and circle and connect then via a callback. The point handle of line widget can be used for dragging/resize circle.

---

<div class="post-metadata">

### Author: ![Manju](https://discourse.vtk.org/user_avatar/discourse.vtk.org/manju/32/7440_2.png) [@Manju](https://discourse.vtk.org/u/Manju)
#### Post date: [May 30, 2023, 12:31pm UTC](https://discourse.vtk.org/t/how-to-draw-a-resizable-circle/11575/3 "2023-05-30T12:31:50Z")

</div>

Thank you for the reply… Those are two separate elements. How do we connect one’s handle to the other

---

<div class="post-metadata">

### Author: ![Jishnu](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jishnu/32/6221_2.png) [@Jishnu](https://discourse.vtk.org/u/Jishnu)
#### Post date: [May 31, 2023, 3:27am UTC](https://discourse.vtk.org/t/how-to-draw-a-resizable-circle/11575/4 "2023-05-31T03:27:26Z")

</div>

You can connect the elements using vtkcallback, refer [this](https://examples.vtk.org/site/Python/Interaction/MouseEvents/) example for vtkcallback implementation. You can use the the mouse click and move events for creating and resizing circle.

---

<div class="post-metadata">

### Author: ![Manju](https://discourse.vtk.org/user_avatar/discourse.vtk.org/manju/32/7440_2.png) [@Manju](https://discourse.vtk.org/u/Manju)
#### Post date: [July 12, 2023, 9:20am UTC](https://discourse.vtk.org/t/how-to-draw-a-resizable-circle/11575/5 "2023-07-12T09:20:44Z")

</div>

That worked. Thank you. Though I used an eventfilter instead of callback… same principle
