Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] expand_y=True to radios makes them expand horizontally other than vertically #5392

Open
2 tasks done
Wes0617 opened this issue Apr 20, 2022 · 2 comments
Open
2 tasks done
Labels
Bug Something's not right duplicate This issue or pull request already exists Port - TK PySimpleGUI

Comments

@Wes0617
Copy link

Wes0617 commented Apr 20, 2022

Type of Issue

BUG


Operating System

Windows 10

PySimpleGUI Port

tkinter


Versions

Python version

3.10

PySimpleGUI Version

4.59.0

GUI Version

tkinter


Troubleshooting

  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org

Detailed Description

expand_y=True on radios makes them expand horizontally other than vertically

Code To Duplicate

import PySimpleGUI as sg

# these radio boxes also expand horizontally, despite expand_x=False
radio1 = sg.Radio("radio1", "g", background_color="blue", expand_y=True)
radio2 = sg.Radio("radio1", "g", background_color="blue", expand_y=True)
radio3 = sg.Radio("radio1", "g", background_color="blue", expand_y=True)
col1 = sg.Col([[]], background_color="red", expand_x=True, size=(100, 300))

radio4 = sg.Radio("radio1", "g", background_color="blue")
radio5 = sg.Radio("radio1", "g", background_color="blue")
radio6 = sg.Radio("radio1", "g", background_color="blue")
col2 = sg.Col([[]], background_color="red", expand_x=True, size=(100, 300))

layout = [
    [radio1, radio2, radio3, col1],
    [radio4, radio5, radio6, col2],
    [sg.Col([[]], size=(1000, 300), background_color="red")]
]

window = sg.Window('Example', layout)
while True:
    event, values = window.read(1000)
    if event == sg.WIN_CLOSED:
        window.close()
        break
@ghost ghost closed this as completed Apr 20, 2022
@ghost ghost added Fill issue form or you will be REJECTED You MUST use the supplied template to submit a request. PySimpleGUI Issues Bot Has Detected an Error and removed Fill issue form or you will be REJECTED You MUST use the supplied template to submit a request. PySimpleGUI Issues Bot Has Detected an Error labels Apr 20, 2022
@ghost ghost reopened this Apr 20, 2022
Repository owner deleted a comment Apr 21, 2022
@jason990420
Copy link
Collaborator

IMO, it is same issue as following two issues and still nothing changed.

The output of user code
image

import PySimpleGUI as sg

# these radio boxes also expand horizontally, despite expand_x=False
radio1 = sg.Radio("radio1", "g", background_color="blue", expand_y=True, key='R1')
radio2 = sg.Radio("radio2", "g", background_color="blue", expand_y=True, key='R2')
radio3 = sg.Radio("radio3", "g", background_color="blue", expand_y=True, key='R3')
col1 = sg.Col([[]], background_color="red", expand_x=True, size=(100, 100), key='C1')

radio4 = sg.Radio("radio4", "g", background_color="blue")
radio5 = sg.Radio("radio5", "g", background_color="blue")
radio6 = sg.Radio("radio6", "g", background_color="blue")
col2 = sg.Col([[]], background_color="red", expand_x=True, size=(100, 100), key='C2')

layout = [
    [radio1, radio2, radio3, col1],
    [radio4, radio5, radio6, col2],
    [sg.Col([[]], size=(500, 100), background_color="red")]
]

window = sg.Window('Example', layout, finalize=True)

for key in ('R1', 'R2', 'R3'):
    pack_info = window[key].Widget.pack_info()
    pack_info['expand'] = 0
    pack_info['before'] = window['C1'].Widget
    window[key].Widget.pack(**pack_info)

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

The output of modified user code
image

@PySimpleGUI
Copy link
Owner

I'm not sure how to get around the mixture problem at the moment. PySimpleGUI combines two tkinter concepts, expand and fill. There's also the problem of the row expanding causing the element to expand/fill. I need, as Jason has indicated, to put some time in on this.

I see in the screenshot about the corrected radio buttons by changing the packing after the fact. I don't have a design yet that will do this as the window is being built. I'm sorry for the delay on these. Expand was added last year and it's not perfect.

@jason990420 jason990420 added Bug Something's not right duplicate This issue or pull request already exists Port - TK PySimpleGUI labels Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something's not right duplicate This issue or pull request already exists Port - TK PySimpleGUI
Projects
None yet
Development

No branches or pull requests

3 participants