bruh nye
bruh nye

Reputation: 39

pysimplegui status bar acting strange

my problem:

i have been trying to make a python clone of notepad to learn how pysimplegui works. so i started with following this video and then changed some code around to look more like notepad. but when i added a status bar i noticed it did not act the way i wanted instead of it being a small strip at the bottom of the window it has a big border going under it and when i resize the window the status bar doesn't really move vertically.

code and images:

here is the code for the gui:

#~~~~imports~~~~
import PySimpleGUI as sg
 
import pathlib
 
WIN_W = 90
WIN_H = 25
 
'''
sg.ChangeLookAndFeel('SystemDefault')
'''
#~~~~layout~~~~
#/settings
menu_def = [['File', ['New    Ctrl+N', 'Open...    Ctrl+O', 'Save    Ctrl+S','Save As...', '---', 'Page Setup...', 'Print...    Ctrl+P', '---', 'Exit'  ]],      
                ['Edit', ['Undo    Ctrl+Z', '---', 'cut    Ctrl+X', 'copy    Ctrl+C', 'Paste    Ctrl+V', 'delete    Del', '---', 'find...    Ctrl+F', 'Find Next    F3', 'Replace...    Ctrl+H', 'Go To...    Ctrl+G', '---', 'Select All    Ctrl+A', 'Time/Date    F5'], ],
                ['format', ['Word Wrap', 'font...'], ],
                ['view', ['Status Bar'], ],      
                ['Help', ['View Help', '---', 'About memopad'], ], ]
 
Ln_numb = 1
Col_numb = 1
#/the layout
layout = [[sg.Menu(menu_def)],
          [sg.Multiline(font=('Consolas', 12), size=(WIN_W, WIN_H-1), key='_BODY_')],
          [sg.StatusBar( text=f'| Ln{Ln_numb},Col{Col_numb}', size=(WIN_W,1), pad=(0,0), text_color='black', background_color='white', relief=sg.RELIEF_FLAT, justification='right', visible=False, key='status_bar' )]
          ]
 
#/window
window = sg.Window('untitled - notepad', icon=['D:/python/memopad/Notepad.ICO'], border_depth=0, layout=layout, element_padding=(0, 0), margins=(0, 0), resizable=True, return_keyboard_events=True, finalize=True)
window['_BODY_'].expand(expand_x=True, expand_y=True)
window['status_bar'].expand(expand_x=True, expand_y=True)
window['status_bar'].update(visible=False)
#~~~~event loop~~~~
status_bar_switch = True
while True:
    event, values = window.read()
    if event in (None, 'Exit'):
        break
 
    if event in ('Status Bar'):
        if status_bar_switch:
            window['status_bar'].update(visible=True)
            status_bar_switch = False
        else:
            window['status_bar'].update(visible=False)
            status_bar_switch = True

this is a image of my notepad clone

looks fine right?

well this is what it look like when streched

this is Microsofts notepad when maximized

and this is my clone when maximized

what i tried:

  1. I added pad(0,0) to the status bar element
  2. I adding expand_row=True to the .expand line of code but noticed no difference
  3. I tried to change the size of the element
  4. I tried to google for an answer
  5. I looked at the pysimplegui docs website

Upvotes: 0

Views: 1840

Answers (1)

bruh nye
bruh nye

Reputation: 39

this was solved by pysimplegui over on github

Upvotes: 1

Related Questions