# Click-and-Drag to draw temporary rectangle on slice

**URL:** <https://discourse.slicer.org/t/click-and-drag-to-draw-temporary-rectangle-on-slice/31917>\
**Category:** Development\
**Created:** [September 26, 2023, 6:45pm UTC](https://discourse.slicer.org/t/click-and-drag-to-draw-temporary-rectangle-on-slice/31917 "2023-09-26T18:45:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dieter\_Rosch](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dieter_rosch/32/67654_2.png) [@Dieter\_Rosch](https://discourse.slicer.org/u/Dieter_Rosch)\
**Post date:** [September 26, 2023, 6:45pm UTC](https://discourse.slicer.org/t/click-and-drag-to-draw-temporary-rectangle-on-slice/31917/1 "2023-09-26T18:45:39Z")

</div>

Hi,

I’m fairly new to Slicer and am working on a plugin for segmentation with a 3rd party tool. One of the functions I want, is to press a button on my plugin, then to use click and drag in a slice to create a rectangular section. I then want to retrieve the top-left and bottom-right (i.e. drag start and drag end positions) and remove the temporary rectangle. I see the scissors tool in segmentation editor has this capability, and have looked at the C++ code, but I can’t figure out a way to do this from Python.

I feel that I am missing something obvious, since this seems a fairly elementary thing to try to do. I’ve searched the recipes and forums, but can’t find anything like this.
