Pysimplegui: [ Bug] Does element_justification for column works?

Created on 16 Sep 2019  路  9Comments  路  Source: PySimpleGUI/PySimpleGUI

Type of Issues (Enhancement, Error, Bug, Question)

Bug

Operating System

Windows 10, 32bit

Python version

python 3.7.4

PySimpleGUI Port and Version

PySimpleGUI 4.4.1

Your Experience Levels In Months or Years

_________ Python programming experience about 3 years
_________ Programming experience overall about 4 to 5 years?
_________ Have used another Python GUI Framework (tkiner, Qt, etc) previously (yes/no is fine)? No

You have completed these steps:

  • [x] Read instructions on how to file an Issue
  • [x] Searched through main docs http://www.PySimpleGUI.org for your problem
  • [x] Searched through the readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • [x] Looked for Demo Programs that are similar to your goal http://www.PySimpleGUI.com
  • [x] Note that there are also Demo Programs under each port on GitHub
  • [x] Run your program outside of your debugger (from a command line)
  • [x] Searched through Issues (open and closed) to see if already reported

Code or partial code causing the problem

So I tried element_justification' forColumn`.

Source form column demo.

without justification :
without justification. Elements in column is justified to left.

with justification :
with justification. Same with above.

And just for sure, with justification in window :
window justification. Everything justified to center.

Does element_justification for Column works?

Bug Done - Download from GitHub

Most helpful comment

Just checked in a fix. I don't have the source code to your test so I can't check against them.

I tested using this mess:

import PySimpleGUI as sg

layout = [[sg.Text('Your typed chars appear here:'), sg.Text('', size=(15,1), key='_OUTPUT_')],
          [sg.Input(key='_IN_')]]

layout += [[sg.T('Same row as column'),sg.Column([[sg.T('1234'*5)],*[[sg.CB(x)] for x in range(5)]] ,element_justification='c' ,key='_COL_', background_color='lightblue', justification='c')], ]

layout += [[sg.TabGroup([[sg.Tab('Tab', [[sg.T('Hello')],[sg.T('1234'*5)]  ], element_justification='c'),]],)]]

layout += [[sg.Listbox([1,2,3,4], size=(10,15), no_scrollbar=True), sg.Listbox([1,2,3,4], size=(10,15), no_scrollbar=True)],
          [sg.Button('Show'), sg.Button('Exit')]]

window = sg.Window('My Title', layout, resizable=True, size=(900,900), element_justification='r' )

while True:  # Event Loop
    event, values = window.read(timeout=300)
    print(event, values) if event != sg.TIMEOUT_KEY else None
    if event in (None, 'Exit'):
        break
    if event == 'Show':
        window['_OUTPUT_'](values['_IN_'])  # Update the "output" element to be the value of "input" element

window.close()

Which produced this window

image

All 9 comments

Sure looks that way. It works for the window level as you've shown, but not for column. Could have something to do with me screwing around with columns, trying to get them to size correctly. Or it may have been in haste when I released a version where elements grew to fit the window. I have a feeling it was that change that broke it.

Oh, and THANK YOU for the very very thorough Issue post. A+ for that!

Just checked in a fix. I don't have the source code to your test so I can't check against them.

I tested using this mess:

import PySimpleGUI as sg

layout = [[sg.Text('Your typed chars appear here:'), sg.Text('', size=(15,1), key='_OUTPUT_')],
          [sg.Input(key='_IN_')]]

layout += [[sg.T('Same row as column'),sg.Column([[sg.T('1234'*5)],*[[sg.CB(x)] for x in range(5)]] ,element_justification='c' ,key='_COL_', background_color='lightblue', justification='c')], ]

layout += [[sg.TabGroup([[sg.Tab('Tab', [[sg.T('Hello')],[sg.T('1234'*5)]  ], element_justification='c'),]],)]]

layout += [[sg.Listbox([1,2,3,4], size=(10,15), no_scrollbar=True), sg.Listbox([1,2,3,4], size=(10,15), no_scrollbar=True)],
          [sg.Button('Show'), sg.Button('Exit')]]

window = sg.Window('My Title', layout, resizable=True, size=(900,900), element_justification='r' )

while True:  # Event Loop
    event, values = window.read(timeout=300)
    print(event, values) if event != sg.TIMEOUT_KEY else None
    if event in (None, 'Exit'):
        break
    if event == 'Show':
        window['_OUTPUT_'](values['_IN_'])  # Update the "output" element to be the value of "input" element

window.close()

Which produced this window

image

So it's working for your code now??!! 馃槂馃憤

Just tested. Works just fine!

Found another bug about column... If there is column inside column, element_justification doesn't works.
Column inside other column, which doesn't justified.

I'll open another issue.

please post your code

Here's the deal on Columns.... They have their own justification setting. What's happening is the column inside the column has a justification field that defaults to left. It's what allows you to position columns anywhere within the space it occupies.

I'll look into the design to see if there's a way to add move "levels of justification" where the interior justification affects everything, unless the justification of a column is intentionally set to a particular value. It's one of the few ways I know of to enable mixing of justification within a column. In other words, some elements are all centered, but some you want to be right justified. For those, you would put them into a Column that has a justification of it's own.

In the meantime, the simple solution is to set the interior column's justification to center.

1979 Here's the code. I'll write more of my problem there.

Was this page helpful?
0 / 5 - 0 ratings