-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathDemo_Justification_Using_Stretch_Elements.py
More file actions
38 lines (25 loc) · 1.27 KB
/
Copy pathDemo_Justification_Using_Stretch_Elements.py
File metadata and controls
38 lines (25 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import PySimpleGUI as sg
"""
Demo Element Justification In A Window Using Stretch Elements
How to Justify elements on 1 row to be left, right or left, middle, right
Additionally, locate these buttons at the bottom of the screen
To get 2 buttons to be all the way to the left and to the far right, then
you want to place a Stretch element between them that expands
If you want a third button that is centered, then add TWO Stretch elements, one
on each side of the middle one
Copyright 2018-2026 PySimpleGUI. All rights reserved.
"""
layout = [ [sg.Text('Window with elements on the left and the right')],
[sg.T('Using a Stretch element that expands enables you to "push" other elements around')],
[sg.HorizontalSeparator()],
[sg.VStretch()], # Stretch verticaly
[sg.Button('Left'), sg.Stretch(), sg.Button('Right')],
[sg.Stretch(), sg.B('Right')],
[sg.Button('Left'), sg.Stretch(), sg.B('Middle'), sg.Stretch(), sg.Button('Right')] ]
window = sg.Window('Left and Right Justification', layout, resizable=True)
while True:
event, values = window.read()
print(event, values)
if event == sg.WIN_CLOSED or event == 'Exit':
break
window.close()