I have sg.Column whit enabled options "scrollable" and "vertical_scroll_only". I add new elements to it using extend_layout. When there are a lot of elements, the scroll is not activated.
I used this article - How to add a field or element by clicking a button in PySimpleGUI?
How can I fix it?
import PySimpleGUI as sg
new_layout = [[sg.T(f'Row 1'), sg.B(' + ', key='-ADD-')]]
layout = [[sg.T('Example Text')],
[sg.Column(new_layout, key='-Column-', size=(100, 200),
scrollable=True, vertical_scroll_only=True)]]
window = sg.Window('For Example', layout)
def new_row(row_amt):
return [[sg.T(f'Row {row_amt}')]]
row_amt = 2
while True:
event, values = window.read()
if event in (sg.WIN_CLOSED, None):
break
elif event == '-ADD-':
window.extend_layout(window['-Column-'], new_row(row_amt))
row_amt += 1