[Solved] Unfocusing screenshot button after click
Posted: Mon Jul 09, 2018 12:45 am
Hi... So I'm using the homemade screenshot function described in this thread -- i.e., using take_screenshot() and get_screenshot() to retrieve an image of the screen.
Right now, I have a camera button on screen that you click to take a screenshot. It has a hover style (the button turns yellow) and a tooltip that shows up underneath when you hover it. Unfortunately these hover elements also show up in all the screenshots and it looks pretty dumb!
What I would like is for those hover styles to work... until the user clicks to take a screenshot. There's got to be something I'm misunderstanding though, because no matter how I try to unset the styles or even just hide the quickmenu screen during the screenshot (just to see if that would work), take_screenshot() always captures the screen while the button is focused.
When I wrap the screenshot functionality in a conditional, like
or even
...Ren'Py will evaluate the statement as true, take the screenshot first, and then hide the screen after. I've also tried plugging some of this stuff into the action of the button itself with the same results.
What do I have to do to unfocus the button during the screenshot?
Right now, I have a camera button on screen that you click to take a screenshot. It has a hover style (the button turns yellow) and a tooltip that shows up underneath when you hover it. Unfortunately these hover elements also show up in all the screenshots and it looks pretty dumb!
What I would like is for those hover styles to work... until the user clicks to take a screenshot. There's got to be something I'm misunderstanding though, because no matter how I try to unset the styles or even just hide the quickmenu screen during the screenshot (just to see if that would work), take_screenshot() always captures the screen while the button is focused.
When I wrap the screenshot functionality in a conditional, like
Code: Select all
renpy.hide_screen("topbar")
if not renpy.get_screen("topbar"):
renpy.take_screenshot((1280, 720))
photo = renpy.game.interface.get_screenshot()
Code: Select all
button = renpy.display.focus.get_focused()
renpy.hide_screen("topbar")
enpy.display.focus.clear_focus() #???
renpy.restart_interaction() #?????????????
if renpy.display.focus.get_focused != button:
renpy.take_screenshot((1280, 720))
photo = renpy.game.interface.get_screenshot()
What do I have to do to unfocus the button during the screenshot?