Demo for the Titlebar element
This commit is contained in:
parent
1bda4e7186
commit
92e78ba665
|
@ -0,0 +1,37 @@
|
||||||
|
import PySimpleGUI as sg
|
||||||
|
|
||||||
|
"""
|
||||||
|
The Custom Titlebar Demo
|
||||||
|
Two ways of getting a custom titlebar:
|
||||||
|
1. set_options - will create a titlebar that every window will have based on theme
|
||||||
|
2. Titlebar element - Adds custom titlebar to your window
|
||||||
|
"""
|
||||||
|
|
||||||
|
sg.set_options(use_custom_titlebar=True)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
layout = [
|
||||||
|
# [sg.Titlebar('My Custom Titlebar', background_color='light blue', text_color='red', k='-T-')],
|
||||||
|
[sg.Text('My Window')],
|
||||||
|
[sg.Input(k='-IN1-')],
|
||||||
|
[sg.Input(k='-IN2-')],
|
||||||
|
[sg.Input(k='-IN3-')],
|
||||||
|
[sg.Button('Clear'), sg.Button('Popup'), sg.Button('Exit')]]
|
||||||
|
|
||||||
|
# Use the same title so that when the window minimizes, the title will be the same as the custom titlebar title
|
||||||
|
window = sg.Window('My Custom Titlebar', layout)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
event, values = window()
|
||||||
|
print(event, values)
|
||||||
|
if event in (sg.WIN_CLOSED, 'Exit'):
|
||||||
|
break
|
||||||
|
elif event == 'Clear':
|
||||||
|
[window[k]('') for k in ('-IN1-', '-IN2-', '-IN3-')]
|
||||||
|
elif event == 'Popup':
|
||||||
|
sg.popup('This is a popup')
|
||||||
|
|
||||||
|
window.close()
|
||||||
|
|
||||||
|
main()
|
|
@ -1,7 +0,0 @@
|
||||||
|
|
||||||
|Screenshot|Demo File|
|
|
||||||
|--|--|
|
|
||||||
| ![https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_Borderless_Window.py](https://user-images.githubusercontent.com/46163555/102439082-95525f00-3feb-11eb-89dd-74cca02bb2f7.jpg) | [Demo_Borderless_Window](https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_Borderless_Window.py) |
|
|
||||||
| ![https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_Base64_Image_Encoder.py](https://user-images.githubusercontent.com/46163555/102439083-95eaf580-3feb-11eb-8c27-07674e60e3d1.jpg) | [Demo_Base64_Image_Encoder](https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_Base64_Image_Encoder.py) |
|
|
||||||
| ![https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_Bar_Chart.py](https://user-images.githubusercontent.com/46163555/102439085-95eaf580-3feb-11eb-81f1-e0f3b34dd4a1.jpg) | [Demo_Bar_Chart](https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_Bar_Chart.py) |
|
|
||||||
| ![https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_All_Widgets.py](https://user-images.githubusercontent.com/46163555/102439086-95eaf580-3feb-11eb-8215-5b89e00585ac.jpg) | [Demo_All_Widgets](https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_All_Widgets.py) |
|
|
Loading…
Reference in New Issue