Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #~~~~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
Add Comment
Please, Sign In to add comment