Page 1 of 1

[SOLVED]We can renpy.set_focus, but how do we renpy.clear_focus? Similar to moving the mouse a little.

Posted: Fri Oct 21, 2022 6:31 pm
by henvu50
edit: code to clear / lose focus is down below, thx to Ocelot

We can renpy.set_focus, but how do we renpy.clear_focus? Similar to moving the mouse a little. I just want to clear the focus from any button.

Is there anything like this, or a way to simulate it?

Code: Select all

renpy.clear_focus()
I'm resorting to creating a fake empty button that does nothing, and setting focus to it, to simulate losing focus, but this doesn't seem right. I shouldn't have to do this.

Code: Select all

    button:
        xsize 0
        ysize 0
        id 'simulate_losing_focus_by_setting_focus_on_me'
        keyboard_focus False
        hover_sound None
        activate_sound None
        action NullAction()
        

Re: We can renpy.set_focus, but how do we renpy.clear_focus? Similar to moving the mouse a little.

Posted: Fri Oct 21, 2022 7:14 pm
by Ocelot
You can try

Code: Select all

renpy.display.focus.set_focused(None, None, None)
renpy.restart_interaction()
Note: not tested, might now work properly.

Re: We can renpy.set_focus, but how do we renpy.clear_focus? Similar to moving the mouse a little.

Posted: Fri Oct 21, 2022 7:17 pm
by henvu50
Ocelot wrote:
Fri Oct 21, 2022 7:14 pm
You can try

Code: Select all

renpy.display.focus.set_focused(None, None, None)
renpy.restart_interaction()
Note: not tested, might now work properly.
It works. I just tested it. Works perfect so far, thank you.