Scrollbars in textboxes? [Ren'Py]

Power Broker

Member
Jan 9, 2018
199
501
I need some help from somebody who is familiar with coding in Ren'Py.

You can write text in the small textbox on the bottom that is standard in Ren'Py and you can also show text in imagemaps, however is there a way to have a textbox with a scrollbar similar to what browsers have? So if I have an amount of text that is bigger than the box, the user can scroll through it.

I was looking for an answer to this question but haven't found any so far, so maybe one of you guys knows.
 

Power Broker

Member
Jan 9, 2018
199
501
Thanks, could you elaborate please? The example given on their page doesn't work:

Code:
init python:
    def say_screen(who, what, **kwargs):
        ui.window(id="window")
        ui.vbox(id="say_vbox")

        ui.text(who, id="who")
        ui.text(what, id="what")

        ui.close()

    renpy.define_screen("say", say_screen)
Code:
Exception: Cannot display None as text.
Also, what's the keyword for having scrollbars and where to put it?
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,224
You're almost certainly looking for a or Vpgrid.

The default game template that is used by every newly created games uses a viewport on the main menu (like when you look at the "about" screen). Though they have made it a bit of pain to follow.

Likewise, the "tutorial" project included with RenPy has Viewport examples.

Basically, you wrap a viewport around the other things you want to display within it.
 
  • Like
Reactions: Cul

riktor

Active Member
Nov 26, 2018
906
1,161
using viewport. will allow you to add scrollbars and define a maximum size. example below is a snippet from a screen i made to display choices in the dialogue box bioware / bethesda style.

Code:
            viewport id 'say_choice':
                if not items[0][1]:
                    ymaximum 110
                else:
                    ymaximum 155
                yinitial 0
                scrollbars "vertical"
                mousewheel True
                draggable True
                pagekeys True
                arrowkeys True
                side_yfill False
 
Last edited:
  • Like
Reactions: WickedCadrach