# Add shortcut to adjust window/level in any mouse mode python script not working

**URL:** <https://discourse.slicer.org/t/add-shortcut-to-adjust-window-level-in-any-mouse-mode-python-script-not-working/21524>\
**Category:** Support\
**Created:** [January 19, 2022, 7:41am UTC](https://discourse.slicer.org/t/add-shortcut-to-adjust-window-level-in-any-mouse-mode-python-script-not-working/21524 "2022-01-19T07:41:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shahnawaz\_Vora](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahnawaz_vora/32/13667_2.png) [@Shahnawaz\_Vora](https://discourse.slicer.org/u/Shahnawaz_Vora)\
**Post date:** [January 19, 2022, 7:41am UTC](https://discourse.slicer.org/t/add-shortcut-to-adjust-window-level-in-any-mouse-mode-python-script-not-working/21524/1 "2022-01-19T07:41:09Z")

</div>

I am trying to use this python script for Brightness/contrast shortcut but it gives me error . Can someone help me

Traceback (most recent call last):  
File “”, line 1, in   
AttributeError: ‘MRMLDisplayableManagerPython.vtkMRMLScalarBarDispl’ object has no attribute ‘GetWindowLevelWidget’

 ![discourse 1](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/c/9c72cfe8e8111a3fb52086bf38dea6ce0449f8cf.png)

---

<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:** [February 25, 2022, 6:58am UTC](https://discourse.slicer.org/t/add-shortcut-to-adjust-window-level-in-any-mouse-mode-python-script-not-working/21524/2 "2022-02-25T06:58:50Z")

</div>

You need to use a recent Slicer Preview Release for this.

For reference, the complete example that allows using Ctrl+Right-click-and-drag for adjusting window/level in Red slice view is available [here](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#add-shortcut-to-adjust-window-level-in-any-mouse-mode).
