# Controlling brush diameter increment when using Shift+Scroll

**URL:** <https://discourse.slicer.org/t/controlling-brush-diameter-increment-when-using-shift-scroll/4247>\
**Category:** Support\
**Tags:** segmentation, python\
**Created:** [October 1, 2018, 4:31pm UTC](https://discourse.slicer.org/t/controlling-brush-diameter-increment-when-using-shift-scroll/4247 "2018-10-01T16:31:12Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![matthew](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/matthew/32/2238_2.png) [@matthew](https://discourse.slicer.org/u/matthew)\
**Post date:** [October 1, 2018, 7:09pm UTC](https://discourse.slicer.org/t/controlling-brush-diameter-increment-when-using-shift-scroll/4247/5 "2018-10-01T19:09:06Z")

</div>

Actually, just found your comment on [this post](https://discourse.slicer.org/t/create-a-mesh-in-python-script/1543/5). And have figured out how to handle keyboard press events. An example that decreases brush diameter when “M” is pressed is shown below:

```
import qt
import slicer

PARAM_DIAM = "BrushAbsoluteDiameter"

def decreaseDiameter():
	segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
	segmentEditorWidget.setMRMLScene(slicer.mrmlScene)
	segmentEditorNode = slicer.mrmlScene.GetSingletonNode("SegmentEditor", "vtkMRMLSegmentEditorNode")
	slicer.mrmlScene.AddNode(segmentEditorNode)
	segmentEditorWidget.setMRMLSegmentEditorNode(segmentEditorNode)

	segmentEditorWidget.setActiveEffectByName("Paint")
	effect = segmentEditorWidget.activeEffect()

	currentDiam = float(effect.parameter(PARAM_DIAM))
	newDiam = currentDiam - 0.5
	print("decreasing to new diam of %0.2f" % newDiam)
	effect.setParameter(PARAM_DIAM, newDiam)
	effect.forceRender

shortcutDecrease = qt.QShortcut(slicer.util.mainWindow())
shortcutDecrease.setKey(qt.QKeySequence("M"))
shortcutDecrease.connect("activated()", decreaseDiameter)
```

However, I am having a problem where the brush diameter does not refresh until I move the mouse. Is there a way to force this to repaint?

---

_[View the full topic](https://discourse.slicer.org/t/controlling-brush-diameter-increment-when-using-shift-scroll/4247)._
