PySimpleGUI / PySimpleGUI

Python GUIs for Humans! PySimpleGUI is the top-rated Python application development environment. Launched in 2018 and actively developed, maintained, and supported in 2024. Transforms tkinter, Qt, WxPython, and Remi into a simple, intuitive, and fun experience for both hobbyists and expert users.
https://www.PySimpleGUI.com
Other
13.34k stars 1.84k forks source link

[Question] Column not scrollable within a Pane #5196

Open gfcwfzkm opened 2 years ago

gfcwfzkm commented 2 years ago

Type of Issue: Question

Column not scrollable within a pane?

Operating System

Windows 11

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

Python version (sg.sys.version)

Python version: 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)]

PySimpleGUI Version (sg.__version__)

PySimpleGUI version: 4.56.0

GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

tkinter version: 8.6.12


Your Experience In Months or Years (optional)

Years Python programming experience Close to 2 Months Years Programming experience overall 11 years VB.NET, 7 years C Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) No Anything else you think would be helpful?


Troubleshooting

These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

Detailed Description

I am trying to get the items within a column to expand in the x-Axis. Naturally I decided to add the Column within a Pane, only to notice that the scrollable feature of the column vanishes once it is inside the pane. Is there a way to force a scrollable column within a pane?

Code To Duplicate

import PySimpleGUI as sg    # pip install pysimplegui

right_list = [[sg.Button(f'Test Stuff {val}', expand_x=True)] for val in range(40)]

left_list = [[sg.Button(f'Test Stuff {val}', expand_x=True)] for val in range(40)]

layout = [[
    sg.Column(left_list, expand_x=True, justification='c', scrollable=True, vertical_scroll_only=True),
    sg.Pane([
        sg.Column(right_list, expand_x=True, justification='c', scrollable=True, vertical_scroll_only=True)],
    orientation='h', relief=sg.RELIEF_SUNKEN, key='-P-')
]]

window = sg.Window('Indexing Options', layout, border_depth=0, modal=True, finalize=True, size=(600, 600))
window['-P-'].expand(True, True, True)

while True:
    event, values = window.read()
    print(event, values)
    if event == sg.WIN_CLOSED:
        break

window.close()

Screenshot, Sketch, or Drawing

Screenshot 2022-02-14 141238

As you can see on the image, the left side is a plain column that is nicely scrollable, except with the Buttons within there not streching to the X-Axis. Using the Column inside a Pane seems to allow the Buttons to strech to the X-Axis, but it also removes the scrolling feature of the column sadly.


Watcha Makin?

Hehe, same as the last time, working on a custom Image Converter for my little image file format for embedded systems. I'm tacking the custom indexed colors option, where I will need to be able to list up to 256 different colors, so a scrollable column seemed logical then to me. tool_screenshot

jason990420 commented 2 years ago

I didn't use the sg.Pane in any of my GUI, so not sure what it for, also anything wrong.

Line 14200 in source code of PySimpleGUI 4.57.0, it is clear that no TkScrollableFrame or TkFixedFrame used, or it replace original settings for sg.Column.

                for pane in element.PaneList:
                    pane.Widget = pane.TKColFrame = tk.Frame(element.PanedWindow)

It looks like some of options in sg.Column not work under sg.Pane, like