# Update Panel content after hotkey is pressed? [duplicate]

I have a checkbox in a panel. I have assigned a toggle hotkey to it. But when i press the hotkey then the checkbox does not change its state until you move with the mouse over the checkbox.

How can i force a redraw at the checkbox when i press the hotkey?

To reproduce, add keymap item with wm.context_toggle and the Context Attribute window_manager.deselect_bool

The script:

﻿import bpy
from bpy.props import BoolProperty

class LayoutDemoPanel(bpy.types.Panel):
bl_label = "Demo Panel"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'

def draw(self, context):
layout = self.layout

wm = context.window_manager # Our bool is in the windows_manager
layout.prop(wm, "deselect_bool") # Our checkbox

def register():
bpy.types.WindowManager.deselect_bool = bpy.props.BoolProperty(
name="Checkbox", description="A checkbox", default = False)
bpy.utils.register_module(__name__)

def unregister():
del bpy.types.WindowManager.deselect_bool # Unregister our flag when unregister.
bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
register()

• Tagging the area to force a redraw via context.area.tag_redraw() should work. Here is an example: gist.github.com/p2or/8a37617c4565e4ff143b736a0e4a1660 – p2or Jul 24 '16 at 14:10
• Also see my answer to your last question: blender.stackexchange.com/a/58534/3710 – p2or Jul 24 '16 at 15:20
• Thank you very much for this example. I have to study this. When i install it as an addon then it works. But when i run it as a script then the panel doesn't show. But at least i have a working example now :) – Tiles Jul 24 '16 at 16:11
• You are welcome! Can't confirm - running this from the text editor also works here without errors in Blender 2.77a on Linux. You can try to remove the bl_info first, but let me know if there is an error... In order to dive in, you can read: blender.stackexchange.com/questions/57306/… (I hope that's helpful at least). – p2or Jul 24 '16 at 16:39
• To make the checkbox update with pressing the hotkey is a follow up problem of the thread you mention here. I thought it is better to make a separate thread for the separated problem. But we could also delete this one since the follower is solved in the original thread. – Tiles Jul 26 '16 at 7:12