2018-09-27 20:24:09 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
import sys
|
2019-10-23 20:10:03 +00:00
|
|
|
import PySimpleGUI as sg
|
|
|
|
|
|
|
|
# Example of colors in PSG
|
|
|
|
|
2018-07-25 10:40:14 +00:00
|
|
|
def main():
|
2018-09-24 22:01:00 +00:00
|
|
|
# ------- Make a new Window ------- #
|
2019-10-23 20:10:03 +00:00
|
|
|
window = sg.Window('GoodColors', default_element_size=(30, 2))
|
|
|
|
window.AddRow(sg.Text('Having trouble picking good colors? Try this'))
|
2018-09-28 18:57:37 +00:00
|
|
|
window.AddRow(sg.Text('Here come the good colors as defined by PySimpleGUI'))
|
2018-07-25 10:40:14 +00:00
|
|
|
|
|
|
|
#===== Show some nice BLUE colors with yellow text ===== ===== ===== ===== ===== ===== =====#
|
2018-09-28 18:57:37 +00:00
|
|
|
text_color = sg.YELLOWS[0]
|
2019-10-23 20:10:03 +00:00
|
|
|
buttons = (sg.Button('BLUES[{}]\n{}'.format(j, c), button_color=(
|
|
|
|
text_color, c), size=(10, 2)) for j, c in enumerate(sg.BLUES))
|
|
|
|
window.AddRow(sg.Text('Button Colors Using PySimpleGUI.BLUES'))
|
2018-09-24 22:01:00 +00:00
|
|
|
window.AddRow(*buttons)
|
2018-09-28 18:57:37 +00:00
|
|
|
window.AddRow(sg.Text('_' * 100, size=(65, 1)))
|
2018-07-25 10:40:14 +00:00
|
|
|
|
|
|
|
#===== Show some nice PURPLE colors with yellow text ===== ===== ===== ===== ===== ===== =====#
|
2019-10-23 20:10:03 +00:00
|
|
|
buttons = (sg.Button('PURPLES[{}]\n{}'.format(j, c), button_color=(
|
|
|
|
text_color, c), size=(10, 2)) for j, c in enumerate(sg.PURPLES))
|
|
|
|
window.AddRow(sg.Text('Button Colors Using PySimpleGUI.PURPLES'))
|
2018-09-24 22:01:00 +00:00
|
|
|
window.AddRow(*buttons)
|
2018-09-28 18:57:37 +00:00
|
|
|
window.AddRow(sg.Text('_' * 100, size=(65, 1)))
|
2018-07-25 10:40:14 +00:00
|
|
|
|
|
|
|
#===== Show some nice GREEN colors with yellow text ===== ===== ===== ===== ===== ===== =====#
|
2019-10-23 20:10:03 +00:00
|
|
|
buttons = (sg.Button('GREENS[{}]\n{}'.format(j, c), button_color=(
|
|
|
|
text_color, c), size=(10, 2)) for j, c in enumerate(sg.GREENS))
|
|
|
|
window.AddRow(sg.Text('Button Colors Using PySimpleGUI.GREENS'))
|
2018-09-24 22:01:00 +00:00
|
|
|
window.AddRow(*buttons)
|
2018-09-28 18:57:37 +00:00
|
|
|
window.AddRow(sg.Text('_' * 100, size=(65, 1)))
|
2018-07-25 10:40:14 +00:00
|
|
|
|
|
|
|
#===== Show some nice TAN colors with yellow text ===== ===== ===== ===== ===== ===== =====#
|
2018-09-28 18:57:37 +00:00
|
|
|
text_color = sg.GREENS[0] # let's use GREEN text on the tan
|
2019-10-23 20:10:03 +00:00
|
|
|
buttons = (sg.Button('TANS[{}]\n{}'.format(j, c), button_color=(
|
|
|
|
text_color, c), size=(10, 2)) for j, c in enumerate(sg.TANS))
|
|
|
|
window.AddRow(sg.Text('Button Colors Using PySimpleGUI.TANS'))
|
2018-09-24 22:01:00 +00:00
|
|
|
window.AddRow(*buttons)
|
2018-09-28 18:57:37 +00:00
|
|
|
window.AddRow(sg.Text('_' * 100, size=(65, 1)))
|
2018-07-25 10:40:14 +00:00
|
|
|
|
|
|
|
#===== Show some nice YELLOWS colors with black text ===== ===== ===== ===== ===== ===== =====#
|
|
|
|
text_color = 'black' # let's use black text on the tan
|
2019-10-23 20:10:03 +00:00
|
|
|
buttons = (sg.Button('YELLOWS[{}]\n{}'.format(j, c), button_color=(
|
|
|
|
text_color, c), size=(10, 2)) for j, c in enumerate(sg.YELLOWS))
|
|
|
|
window.AddRow(sg.Text('Button Colors Using PySimpleGUI.YELLOWS'))
|
2018-09-24 22:01:00 +00:00
|
|
|
window.AddRow(*buttons)
|
2018-09-28 18:57:37 +00:00
|
|
|
window.AddRow(sg.Text('_' * 100, size=(65, 1)))
|
2018-07-25 10:40:14 +00:00
|
|
|
|
2018-09-24 22:01:00 +00:00
|
|
|
#===== Add a click me button for fun and SHOW the window ===== ===== ===== ===== ===== ===== =====#
|
2018-09-28 18:57:37 +00:00
|
|
|
window.AddRow(sg.Button('Click ME!'))
|
2019-10-23 20:10:03 +00:00
|
|
|
event, values = window.read()
|
|
|
|
|
|
|
|
window.close()
|
2018-07-25 10:40:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|