scrollable.pyΒΆ

open in new tab
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
Example that shows how to make the content of a widget scrollable.
It comes down to setting a style attribute: "overflow-y: auto;".
"""

from flexx import flx


class ScrollExample(flx.Widget):

    CSS = """
    .flx-ScrollExample {
        overflow-y: scroll;  // scroll or auto
    }
    """

    def init(self):

        with flx.Widget():
            for i in range(100):
                flx.Button(text="button " + str(i))


if __name__ == '__main__':
    m = flx.launch(ScrollExample)
    flx.run()