Using a scrollbar to scroll imagebuttons [SOLVED]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
User avatar
AlceX
Newbie
Posts: 18
Joined: Fri Feb 27, 2015 11:51 am
Contact:

Using a scrollbar to scroll imagebuttons [SOLVED]

#1 Post by AlceX »

Hey! I'm new to Ren'Py and I've been doing fine so far looking at the documentation and tutorials, but I got stuck on this.

Is there any way to create a scrollbar and use it to scroll imagebuttons? I'm guessing it would be something like:

- Create scrollbar
- Create a variable and set it according to the position of the thumb on the bar
- Set pos of the imagebuttons according to previously mentioned variable

...but I'm not even sure on how to create a scrollbar. I messed around with viewports and Python a bit, but I didn't really get very far. Here's a few mockup images in case you don't undestand what I want to do. Thanks in advance!
Attachments
example3 (1).png
example3 (1).png (2.17 KiB) Viewed 635 times
example2 (1).png
example2 (1).png (2 KiB) Viewed 635 times
example1 (1).png
example1 (1).png (2.29 KiB) Viewed 635 times
Last edited by AlceX on Sat Feb 28, 2015 6:32 pm, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Using a scrollbar to scroll imagebuttons

#2 Post by philat »

What you want is viewport. Example of code: http://lemmasoft.renai.us/forums/viewto ... 43#p328769

User avatar
AlceX
Newbie
Posts: 18
Joined: Fri Feb 27, 2015 11:51 am
Contact:

Re: Using a scrollbar to scroll imagebuttons

#3 Post by AlceX »

Thanks for pointing me in the right direction! I had a feeling it had something to do with viewports...

For anyone who finds this later, here's the code I ended up using in the end:

Code: Select all

screen test:
    window id "window":
    
        has viewport
        draggable True
        scrollbars "horizontal"
        ymaximum 100
        side_ypos -300
        
        hbox:
            spacing 200
            imagebutton auto "gui/pracexp/pracexp_morning_%s.png" focus_mask True action Jump("morning")
            imagebutton auto "gui/pracexp/pracexp_afternoon_%s.png" focus_mask True action Jump("afternoon")
            imagebutton auto "gui/pracexp/pracexp_evening_%s.png" focus_mask True action Jump("evening")
Attachments
result.png
result.png (4.26 KiB) Viewed 613 times

Post Reply

Who is online

Users browsing this forum: Google [Bot]