PySimpleGUI/DemoPrograms/Demo_Nice_Buttons.py

74 lines
30 KiB
Python
Raw Normal View History

import PySimpleGUI as sg
import os
import io
from PIL import Image, ImageDraw, ImageTk, ImageFont
import base64
import subprocess
import sys
orange64 = 'iVBORw0KGgoAAAANSUhEUgAAAiIAAADLCAMAAABkvgh7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQAAANtvJ99sId5tIt5uI91tJNxuJNxuJttvKN90NN91Ntt3PN52ONx3Otx3PNt4Pdp4Ptx4PepfD+pfEOtgD+piD+tkD+ttD+dnFOdoE+doFOVoFuNqG+JrHOFrHuFsHuRpGORpGuRqGORqGupgEOpiEOpkEOlmEOhnEupoEOpoEupqFettEetsF+tuFOxqFetrGOtsGetvHOxrGOxsGOxtGuxuG+xuHexxFutwH+xxGOxyGOxyGuxxHuBsIOJvJ+NvKORvKONwKeNwKuJxLONyLeJyLuRwKeRwKuRxLOtxIexyIexzJOx0JOx1Ju11KOx2KOx2Kux5Iux4Kux5Le1/LeFyMOFzMuB0NOB1Nux7MOx8MOx8Mu19NO1+NO1+Ntd7RdV8RtN+S9J/TdF/TtV9SNR9Stl5QNl6Qdh6Qth7RK+Tfa+Tfq6Ufr+JZb+JZr+KZ7uMbr6KaL6LaryMbLyNb7yOb7WPdLuNcLqOcLmOcrmPdLOQd7SQdrKReLKRerGSerCTfLCTfrmQde2AN+2AOO2BOu2COu6DPO6EPe6EPsWDV8OFXcOFXsOGXcOGXsaDWMSEWsqCVs+AUM2AUs6CU82CVMqDWMmEWtCAT9CAUMKHYMCIYsCIZMCKZu6FQO6GQe6GQu6HRO6IRe6JRu6KR+6KSO+LSu+MS++MTO+OTe+OTu+OUO+RUu+TVfCNTvCOTvCPUPCQUfCQUvCSU/CRVPCSVPCSVvCUV/CUWPCVWvGWWvGXXPGYXvCWYPGaYfGcYvGcZPKdZvKeZ/GdavKeaPKebfKebvKgavKhbPKibfGibvKjcPGkcfKmdPKiePOod/OpePSpePSqevSrfPSsfPSsfvSqg/SugfWwgvWwhPWyhfWyhvWxi/Wyj/W0ifW2jfa4j/a1kPW2kva2lfW2lvW4kPa6kfa7kva5lvW7lPa8lPW8lve+l/a4mva5nPa6nPa7nva+mPa+mva/nPa8oPa9ovbAm/bAnfXAnvbCofbEo/XGp/bGqPbIqQAAAC/NnaUAAAEAdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wBT9wclAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGHRFWHRTb2Z0d2FyZQBwYWludC5uZXQgNC4xLjFjKpxLAAAJXElEQVR4Xu3de3zVdR3H8Xb9/sJh60LlOTtubdIZEyckSdedMzkdZyRGIePmZdqki8s0KllJmtGCTAXRlUAyrireUeZga2JRkooYRWR0JbXMLsIqZ5fT7/L5nRvj9/md0/fhw/Px/fyHP+D33fb4vPj+LvsxXpMA8IREgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgIFEgJF7Ih1Xf3bVsuu/AYXu+mUrL+u8iqbqIcdErvhme0V8SjQCIpwWe+0nli+k2R5NTolc0jYzqpQBcigV+UDltZ57SQ6JfLqyRRXRyiCIis7u7qAhj8B3Ip1tLdg/pFLR0Z+hOR/JbyIrWxGIZCp289E2Ep+J3HzEFqLKy0qhUJUfeUkZnf8lGnYWX4l0tDfTOg5VEqoJNNTXh6EgmaMLBKuaymmcJFLRSfPO5CuRtgitYisPBehDQUFrqC3O2EtUxRdo4Bn8JHJhlNawlNZh85Aj2JQeiRp9JY08nY9Euk+nFUwq1ECLgww1ZTRaS+R8mnk6PpEF8dTDkNIgLQxiHFdNw7U0d9PU07CJdLw+tRUVpy5Cxo19+bz9lYI+n5cNfdhcjWGZf2jsCTTJcDiUmnBR/HKaewqbSHfqQqSJrkLGvuuctZu3jOgBD1u99B7Fg6a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zs6bN4BJublgzMI6xYdjW3A
def image_file_to_bytes(image64, size):
image_file = io.BytesIO(base64.b64decode(image64))
img = Image.open(image_file)
img.thumbnail(size, Image.ANTIALIAS)
bio = io.BytesIO()
img.save(bio, format='PNG')
imgbytes = bio.getvalue()
return imgbytes
def ShowMeTheButtons():
bcolor = ('black', 'black')
wcolor = ('white', 'black')
sg.change_look_and_feel('Black')
sg.set_options(auto_size_buttons=True, border_width=0,
button_color=sg.COLOR_SYSTEM_DEFAULT)
toolbar_buttons = [[sg.Text('Who says Windows have to be ugly when using tkinter?', size=(45, 3))],
[sg.Text(
'All of these buttons are part of the code itself', size=(45, 2))],
[sg.RButton('Next', image_data=image_file_to_bytes(button64, (100, 50)), button_color=wcolor, font='Any 15', pad=(0, 0), key='-close-'),
# [sg.RButton('Exit', image_data=image_file_to_bytes(black64, (100,50)),button_color=bcolor, font='Any 15', pad=(0,0), key='-close-'),],
sg.RButton('Submit',
image_data=image_file_to_bytes(
red_pill64, (100, 50)),
button_color=wcolor, font='Any 15', pad=(0, 0), key='-close-'),
sg.RButton('OK', image_data=image_file_to_bytes(green_pill64, (100, 50)),
button_color=bcolor, font='Any 15', pad=(0, 0), key='-close-'),
sg.RButton('Exit', image_data=image_file_to_bytes(orange64, (100, 50)), button_color=bcolor, font='Any 15', pad=(0, 0), key='-close-'), ],
]
# layout = toolbar_buttons
layout = [[sg.Frame('Nice Buttons', toolbar_buttons,
font=('any 18'), background_color='black')]]
window = sg.Window('Demo of Nice Looking Buttons', layout,
no_titlebar=False, grab_anywhere=True,
keep_on_top=True, use_default_focus=False,
font='any 15', background_color='black', finalize=True)
# ---===--- Loop taking in user input --- #
while True:
button, value = window.read()
print(button)
if button == '-close-' or button is None:
break # exit button clicked
if __name__ == '__main__':
# To convert your PNG into Base 64:
# Go to https://www.base64-image.de/
# Drag and drop your PNG image onto the webpage
# Choose "Copy image"
# Create a string variable name to hold your image
# Paste data from webpage as a string
# Delete the "header" stuff - up to the data portion (data:image/png;base64,)
ShowMeTheButtons()