Ren'Py Showing a screen on textbutton hover

Johor1

Newbie
Nov 9, 2018
55
21
I've defined a screen which shows when a textbutton is clicked on. That works fine, but just for user-friendliness I want it to also be shown when the textbutton is hovered and hidden when it's unhovered, to give the player a quick overview. The unhovering bit works fine, but when hovered the screen flickers several times a second like a flickery thing with a degree from Flickering University.

Having looked for a few hours online and finding nothing that helped, I'm asking here. Here's the relevant code.

Code:
screen todo_list():
    $ itodo = 0
    frame:
        xpos 1120
        ypos 200
        xsize 160
        ysize 300
               
        text "{size=15}Your tasks:{/size}" outlines[ (absolute(1), "#000", absolute(0), absolute(0)) ]
        vbox:
            null height 30
            xalign 0.5
            spacing 5
            if ntasks_to_do > 0:
                for itodo_1 in range(0,ntasks_per_week):
                    $ areastyle = area_name[itasklocationlist[itodo_1]]
                    $ screentask = tasktypelist[itodo]
                    $ newcolour1 = taskcolourlist[itodo]
                    if not ftaskdone[itodo_1]:
                        textbutton "{color=#[newcolour1]}[screentask]{/color}" action SetVariable("itodo", itodo_1) style style.button[areastyle] at truecenter:
                            text_outlines [ (absolute(1), "#000", absolute(0), absolute(0)) ]
                           
                            hovered Show("display_task")        # <<<----- screen is shown, but flickers
                           
                            unhovered Hide("display_task")
                    $ itodo += 1
            else:
I'm using Renpy 7.3.5.606. Thanks in advance for any help.
 

GNVE

Active Member
Jul 20, 2018
701
1,158
haven't tried this yet (really should, I need it too). but maybe this will be useful?
 
  • Like
Reactions: anne O'nymous

Playstorepers

Member
May 24, 2020
160
79
you can theoretically take the cheap cop-out and replace your textbutton with an image button: idle = normal "textbutton" and once hovered, it opens a "screen". Everything in "" is an image, of course.

Otherwise, I'd say, the flicker is a result of the fact, that your new "display_task" screen blocks out the textbutton.
So take out the modal out of your display_task screen with modal False, which allows the lower screens to be used and make sure, that the new screen does not cover the textbutton.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,363
15,280
I've defined a screen which shows when a textbutton is clicked on. That works fine, but just for user-friendliness I want it to also be shown when the textbutton is hovered and hidden when it's unhovered, to give the player a quick overview.
Code:
screen todo_list():
[...]
                        textbutton "{color=#[newcolour1]}[screentask]{/color}" [...]:
                            tooltip "images/myImageToShow.jpg"
[...]
    $ tt = GetTooltip()
    if tt:
        frame:
            xalign 0.5
            yalign 0.5
           add tt size (100,100)
Just style the frame like you want, and change the value for size according to the size you want.
 

GNVE

Active Member
Jul 20, 2018
701
1,158
you can theoretically take the cheap cop-out and replace your textbutton with an image button: idle = normal "textbutton" and once hovered, it opens a "screen". Everything in "" is an image, of course.

Otherwise, I'd say, the flicker is a result of the fact, that your new "display_task" screen blocks out the textbutton.
So take out the modal out of your display_task screen with modal False, which allows the lower screens to be used and make sure, that the new screen does not cover the textbutton.
I would advice against this. Yes it works but if you want to use them more often than a dozen times or so it will get quite time consuming rather than doing it right the first time.
 
  • Like
Reactions: Playstorepers

Johor1

Newbie
Nov 9, 2018
55
21
So take out the modal out of your display_task screen with modal False...
Thanks, that was what caused the flicker, even though it didn't cover the textbuttons. So now I have to decide how to show the screen hovered and selected. I'll probably go for the quick and dirty option of duplicating it with different modal settings for the moment, as the modal property is apparently fixed at the start of the game. I know it's not best practice, but it'll do.

Thanks to everyone for their comments.