1

I'm looking to create a simple menu type thing, where my window is split into 2 halves, and I want the left hand side to be scrollable, but the right hand side to be stationary.

I'm new to PySimpleGUI, and I've looked through the mess that is the docs and it looks like maybe frames might be a good way to go, however I'm not too sure on how I would get a scroll bar. Is it automatic when there's more elements then can fit in the frame, or do I have to have some code that enables it?

  • It's a good bet that any multiline text box will become scrollable if the text exceeds the size of the box. Or there may be a flag to use when you create it. What have you tried? – RufusVS Sep 24 '21 at 23:46
  • @RufusVS i havent really tried anything because the documentation doesnt mention anything on it, and there are no questions (that i can find) with the same issue. –  Sep 25 '21 at 00:15
  • if PySimpleGUI uses only standard widgets in Tkinter then it can be problem because in Tkinter scrollable can be only `Text`, `Canvas` and `Listbox`. You can to scroll something more complex then you has to put Frame on Canvas and scroll Canvas to simulate scrolled Frame - see [scrolled frame and canvas](https://github.com/furas/python-examples/tree/master/tkinter/scrolled-frame-canvas) in Tkinter. – furas Sep 25 '21 at 01:41

1 Answers1

1

If you runs help(sg.Column) then you should see

 __init__(self, ..., scrollable=False, vertical_scroll_only=False, ....)

EDIT:

You have it also in documentation on page Call reference

https://pysimplegui.readthedocs.io/en/latest/call%20reference/#column-element


import PySimpleGUI as sg

help(sg.Column)

column1 = [
    [sg.Text(f'Scrollable{i}')] for i in range(10) 
]

column2 = [
    [sg.Text(f'Static{i}')] for i in range(10) 
]

layout = [
    [
        sg.Column(column1, scrollable=True,  vertical_scroll_only=True),
        sg.Column(column2)
    ]
]

window = sg.Window('Scrollable', layout)
event, values = window.read()
window.close()

enter image description here


EDIT:

Very interesting information from @MikefromPSG comment:

Calling `sg.main_sdk_help()` will also give you a nice bit of help info.  
It's the docstrings that I rely on the most (in PyCharm). 

In the help window you'll also find a link to the online call reference 
that will launch your browser should you want to go that route.
import PySimpleGUI as sg

sg.main_sdk_help()

enter image description here

furas
  • 134,197
  • 12
  • 106
  • 148
  • 1
    Calling `sg.main_sdk_help()` will also give you a nice bit of help info. It's the docstrings that I rely on the most (in PyCharm). In the help window you'll also find a link to the online call reference that will launch your browser should you want to go that route. – Mike from PSG Sep 25 '21 at 12:36
  • @MikefromPSG it is very useful information. I added your comment to my answer - so it will be more visible. – furas Sep 25 '21 at 14:19