Hiding the textbox

Badger-WEG

New Member
Nov 18, 2024
4
0
25
I have a rewards gallery, which is a slightly edited version of SmileFlower's (previously called NingNing) Renpy Gallery on itch. Everything works fine, but when you click the imagebutton to view the image fullscreen, it also brings up the textbox.

Here's the relevant code:

Code:
#All imagebuttons appear like this
add gal.make_button("a1","gallery/u_reward1a.jpg", locked = "gallery/2/locked_3.png")

#Persistent code
gal.button("a1")
gal.condition("persistent.a1")
gal.image("gallery/u_reward1.jpg")
I'm not sure why the textbox is appearing, but it is, and it's not ideal for a gallery. Does anybody know how to stop this happening?
 

Turning Tricks

Rendering Fantasies
Game Developer
Apr 9, 2022
2,008
3,726
353
Without seeing all the associated code, I'd have to venture a guess that perhaps you are calling the Gallery from within the game loop? Most of the Gallery scripts I have seen usually add the Gallery as an option from the Main Menu.

If you call the Gallery from inside the game, then you probably have to add some sort of Modal = True to the screen code. Otherwise clicking on the gallery image will advance the dialogue.

My Gallery code calls the gallery using ShowMenu("gallery") , which I believe behaves differently than if you just call the gallery as a custom screen.

This is all guess work though.
 

Badger-WEG

New Member
Nov 18, 2024
4
0
25
Thanks for the reply. I'm calling the gallery from an in-game phone, so another screen open during the game loop. So yeah. it's a screen, within a screen, within a screen type situation.

I've got modal true in there and the dialogue doesn't advance or appear. It just shows an empty textbox.

My issue comes with using somebody else's code that I don't fully understand. So, all of my screens have modal True. They all show, hide, etc. They all work fine, and I understand that part of the code. What I don't quite get is how the code for the gallery imagebutton tells Ren'py to show an image full screen. Because at some point here, it shows the image with an empty textbox.

Code:
screen gallery_rewards1():
    zorder 2
    tag menu
    modal True
    add "gallery_bg"
    add "gallery_rewards" xpos 30 ypos 35
    imagebutton:
        xalign 0.99
        yalign 0.01
        auto "mobile/menus/exit_%s.png"
        action [Hide("gallery_rewards"), Show("gallery_home")]
    grid 6 4:
        spacing 20
        yalign 0.50
        xalign 0.50
        add gal.make_button("b1","gallery/reward_b1a.jpg", locked = "gallery/2/locked_3.png")
        #and then add gal button on repeat for all images.
Then underneath, there's this:
Code:
init python:
    gal = Gallery()

    gal.button("b1")
    gal.condition("persistent.b1")
    gal.image("gallery/reward_b1.jpg")
    
#and repeat for all images.
That's essentially all the code in the gallery. So I'm assuming the issue is with the 'add gal.make_button' code, but because I don't fully understand it, I'm not quite sure.
 

Turning Tricks

Rendering Fantasies
Game Developer
Apr 9, 2022
2,008
3,726
353
Hmmm..

Maybe experiment with using a frame instead of a grid as the container? That way you could use a background that would hide the Say screen text box.

I'd also try commenting out the zorder line or maybe changing it to 3 or 4. (higher numbers closer to the screen)

I'm still learning the gallery functions. Mine is more complicated but it uses Ren'py's own gallery engine so you don't have to mess with persistent variables. Just lock or unlock the images with a $ renpy.mark_image_seen or $ renpy.mark_image_unseen

If you figure this out, please post the fix. I am curious to learn more. :)
 
Last edited:

MissFortune

I Was Once, Possibly, Maybe, Perhaps… A Harem King
Respected User
Game Developer
Aug 17, 2019
6,907
10,682
872
Do you have a conditional for when the phone is open? Something like:

Python:
phone_is_open
Could be as easy as using that to hide the dialogue box:

Python:
if phone_is_open is True:
    window hide
elif phone_is_closed is True:
    window show
 

Badger-WEG

New Member
Nov 18, 2024
4
0
25
Thanks for the advice. I haven't looked into Renpy's own galleray at all so I might have to try that out instead.

Just to clarify, the textbox doesn't appear over the gallery screen, only when an image is opened using the gal.make_button. So the fullscreen gallery image has the textbox over it, and the textbox disapears again when the image is closed and you return to the gallery. So zorder doesn't change anything and neither does the grid unfortunately. I tried both, just in case, but no luck.

I don't have a conditional set, so I made one, but couldn't get renpy to let me use hide in the screen and I couldn't figure a way around that.
Code:
[code]

File "game/gallery.rpy", line 38: 'hide' is not a keyword argument or valid child of the screen statement.
    window hide
        ^
[/CODE]
 

MissFortune

I Was Once, Possibly, Maybe, Perhaps… A Harem King
Respected User
Game Developer
Aug 17, 2019
6,907
10,682
872
It's kind of brute forcing, but it should work:

Python:
action [Hide("say"), Hide("nvl"), Hide("choice")]
Then just use "Show" (with the same actions) on exit. HideInterface might work as well:

Python:
action HideInterface()
Edit: Saw it somewhere else, but "zorder 100" might be worth a try.
 
Last edited:

gojira667

Member
Sep 9, 2019
363
392
187
Seems this uses . The image_screen kwarg defaults to the "_gallery" screen which resides in renpy/common/00gallery.rpy as mentioned at the end.

:unsure: Not sure if your package also has a custom image_screen though.

The Gallery button code make use of __GalleryAction class for it's button action. That in turn uses when the action is invoked.

The context switch combined with you not being in a menu context might be the cause of the errant text box. I would expect the Window Management to work though.

is Ren'Py script and not Ren'Py screen language. There are if you needed them for some reason.
 

Badger-WEG

New Member
Nov 18, 2024
4
0
25
This is a huge help. I'll look into what you've suggested and try to wrap my head around the gallery code. And if for some reason I can't, I'll try the action [Hide... code. Thanks for the help