# Segment editor Hotkeys Not working

**URL:** <https://discourse.slicer.org/t/segment-editor-hotkeys-not-working/7071>\
**Category:** Support\
**Created:** [June 7, 2019, 2:54pm UTC](https://discourse.slicer.org/t/segment-editor-hotkeys-not-working/7071 "2019-06-07T14:54:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amine](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/amine/32/4844_2.png) [@Amine](https://discourse.slicer.org/u/Amine)\
**Post date:** [June 7, 2019, 2:54pm UTC](https://discourse.slicer.org/t/segment-editor-hotkeys-not-working/7071/1 "2019-06-07T14:54:44Z")

</div>

Hotkeys of segment editor for numbers 1,2,… ,9,0 work but the ones with shift +1,2,3…0 (to select effects 11 12… 20 as the documentation says) does not work, tried on slicer 4.10.1 4.10.2 and 4.11 and two different computers, is there something i’m doing wrong or was it disabled? thanks

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 7, 2019, 4:24pm UTC](https://discourse.slicer.org/t/segment-editor-hotkeys-not-working/7071/2 "2019-06-07T16:24:15Z")

</div>

I’ve just tried Shift+number shortcuts and they works well for me on Windows. What operating system do you use?

Maybe Shift+number keys are not reliably detected as keyboard shortcuts on all platforms. You can define your custom key combinations by customizing then copying the code below to your [.slicerrc.py file](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#How_to_systematically_execute_custom_python_code_at_startup_.3F):

```auto
editor = slicer.modules.segmenteditor.widgetRepresentation().self().editor

shortcuts = [
    ('Ctrl+b', lambda: editor.setActiveEffectByName('Surface cut')),
    ('Ctrl+n', lambda: editor.setActiveEffectByName('Fast Marching')),
    ]

for (shortcutKey, callback) in shortcuts:
    shortcut = qt.QShortcut(slicer.util.mainWindow())
    shortcut.setKey(qt.QKeySequence(shortcutKey))
    shortcut.connect( 'activated()', callback)

```

---

<div class="post-metadata">

**Author:** ![Amine](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/amine/32/4844_2.png) [@Amine](https://discourse.slicer.org/u/Amine)\
**Post date:** [June 7, 2019, 5:22pm UTC](https://discourse.slicer.org/t/segment-editor-hotkeys-not-working/7071/3 "2019-06-07T17:22:24Z")

</div>

> [@lassoan](#):
>
> editor = slicer.modules.segmenteditor.widgetRepresentation().self().editor shortcuts = [(‘Ctrl+b’, lambda: editor.setActiveEffectByName(‘Surface cut’)), (‘Ctrl+n’, lambda: editor.setActiveEffectByName(‘Fast Marching’)),] for (shortcutKey, callback) in shortcuts: shortcut = qt.QShortcut(slicer.util.mainWindow()) shortcut.setKey(qt.QKeySequence(shortcutKey)) shortcut.connect( ‘activated()’, callback)

This worked perfectly, only difference being it doesen’t switch back and forth between the effect and “none” when pressed twice like the predefined ones but does the trick, interestingly, shift+letter works fine and ctrl+number as well but shift+ number does not (maybe because it is already assigned to changing the effects)  
i tried on both windows 10 and windows 7.  
Thanks a lot, that will save me quite some time!!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 10, 2019, 6:29pm UTC](https://discourse.slicer.org/t/segment-editor-hotkeys-not-working/7071/4 "2019-06-10T18:29:41Z")

</div>

> [@Amine](#):
>
> only difference being it doesen’t switch back and forth between the effect and “none” when pressed twice like the predefined ones

You can call a custom function (instead of `setActiveEffectByName` directly) that checks which effect is active and if the selected effect is already active then it deactivates it.
