Is that possible?
I can think of ways to work around this, of course, like creating a button-background which is wider than the actual image (character image), and just placing the text above it, but that seems like a hackish workaround.
What I would like is for a stats-screen to work with having both an image of the character, and the name of the character, and preferably both be clickable (like it was all one button), and open the same content (stats).
Is this easily possible using an already existing imagebutton?
Combine imagebutton and text into one button?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- RicharDann
- Veteran
- Posts: 286
- Joined: Thu Aug 31, 2017 11:47 am
- Contact:
Re: Combine imagebutton and text into one button?
I asked a similar question some time ago:
viewtopic.php?f=8&t=45941#p466450
I went with Remix's suggestion in the end because I needed the automatic image change on hover imagebutton provides, but if your character's image doesn't need to change and you only need button functionality then using Button is also a valid option.
viewtopic.php?f=8&t=45941#p466450
I went with Remix's suggestion in the end because I needed the automatic image change on hover imagebutton provides, but if your character's image doesn't need to change and you only need button functionality then using Button is also a valid option.
The most important step is always the next one.
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Combine imagebutton and text into one button?
The 'just stack all the stuff on top of each other in a fixed' approach, as suggested, would work fine, though you might also want to look at using text button.
From a quick 'rather untested' sleuth around the code, TextButton seems to sit on a scalable frame and actually changes the frame image on hover and unhover. It shouldn't be too tricky to track down the 'choice_button' styles in gui.rpy, make some new ones and add some hover/idle images to the game/gui folder (like the choice_ ones in there that are used for menu: blocks)
Then it would just be a case of:
... textbutton "{space=10}{image='icon.png'}{space=4}The Name{space=10}" style_prefix="whatever" action ... etc
From a quick 'rather untested' sleuth around the code, TextButton seems to sit on a scalable frame and actually changes the frame image on hover and unhover. It shouldn't be too tricky to track down the 'choice_button' styles in gui.rpy, make some new ones and add some hover/idle images to the game/gui folder (like the choice_ ones in there that are used for menu: blocks)
Then it would just be a case of:
... textbutton "{space=10}{image='icon.png'}{space=4}The Name{space=10}" style_prefix="whatever" action ... etc
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Who is online
Users browsing this forum: Bing [Bot], Sugar_and_rice