0

I am trying to make string appear as that same length, so that when joined they appear as columns.

    import PySimpleGUI as sg
    a = ('IIII'.rjust(6,'*'))
    b = ('OOOO'.rjust(6,'*'))
    layout = [[sg.Text(a), sg.Text(a), sg.Text(a)], [sg.Text(b), sg.Text(b), sg.Text(b)]]
    window = sg.Window('Test Window', layout)
    event, values = window.read()
    window.close()

Because the 'I' is narrower than the 'O' the columns do not line up. Ultimately, I want to use the strings as a list box. Thanks, for any help.

  • You could try `sg.SetOptions(font=("Courier New", 20))` to use a monospaced font (or find some other font that's monspaced). – user2740650 Nov 14 '20 at 17:14
  • 2
    You can add the `font` parameter on the `Text` element or at the `Window` level as well. `set_options` will change the font for all `Text` elements for all windows that are created. – Mike from PSG Nov 14 '20 at 19:19

1 Answers1

0

Wow, works like a charm. Thanks