NEW Technique... add a 1 pixel size(0,0) canvas to a row and the row will shrink when others made invisible

This commit is contained in:
PySimpleGUI 2020-08-03 15:24:07 -04:00
parent 271ca7d662
commit 00c9e37300
2 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@ import PySimpleGUI as sg
""" """
layout = [[sg.Col([[sg.Text('My Window')], [sg.Input(key='-IN-'), sg.Button('My button', key='-OUT-')]], key='-COL-')], layout = [[sg.Col([[sg.Text('My Window')], [sg.Input(key='-IN-'), sg.Button('My button', key='-OUT-')]], key='-COL-'), sg.Canvas(size=(0,0), pad=(0,0))],
[sg.Button('Invisible'), sg.Button('Visible'), sg.Button('Exit')]] [sg.Button('Invisible'), sg.Button('Visible'), sg.Button('Exit')]]
window = sg.Window('Window Title', layout) window = sg.Window('Window Title', layout)

View File

@ -24,7 +24,7 @@ def pin(elem):
:param elem: the element to put into the layout :param elem: the element to put into the layout
:return: A column element containing the provided element :return: A column element containing the provided element
''' '''
return sg.Column([[elem]], pad=(0,0)) return sg.Column([[elem, sg.Canvas(size=(0,0), pad=(0,0))]], pad=(0,0))
layout = [ [sg.Text('Window with Hidden Button')], layout = [ [sg.Text('Window with Hidden Button')],