Reputation: 39
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:
Upvotes: 0
Views: 1840