Snippets

SinnyStar [Ren'Py] Automatically scroll to the bottom of a viewport

Created by Sinny Star
init python:

    class NewAdj(renpy.display.behavior.Adjustment):
        def change(self,value):
            if value > self._range and self._value == self._range:
                return Return()
            else:
                return renpy.display.behavior.Adjustment.change(self, value)                

    # The adjustment
    yadj = NewAdj()

    # The Python function to scroll to the bottom                
    def scroll_bottom():
        yadj.value = yadj.range
        
    # Action equivalent
    class ScrollToBottom(Action):
        def __init__(self):
            self.adj = yadj
        def __call__(self):
            self.adj.value = self.adj.range

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.