Open In App
Related Articles

Themes in PySimpleGUI

Improve Article
Save Article
Like Article

Themes are used for designing Beautiful windows. It gives the user a choice to showcase his creativity on the GUI with colors. Coloring the GUI window can be accomplished with 1 line of code.

sg.theme('Dark Amber 5')

Note: Dark Amber is the name of the Theme and 5 is the version or the patch.

We make a call to theme attribute which can set the colors for using when creating a GUI window. It can be used to color text, background, input field, button, and so on. We can see the preview of the themes, make this call to generate a preview of the available themes:

import PySimpleGUI as sg


Theme List and Getting Theme Names

In addition to having these themes, One can no longer need to specify the exact string to have the Theme he/ she wishes. Now you can add spaces, change the case, even move words around and you’ll still get the correct theme. For example, the theme “DarkAmber2” can be specified also as “Dark Amber 2” . If you are unable to remember the names and going wrong, you will surely get a text list of the available choices printed on the console. You can also get the list of themes by calling theme_list


import PySimpleGUI as sg
theme_name_list = sg.theme_list()


[‘Black’, ‘BlueMono’, ‘BluePurple’, ‘BrightColors’, ‘BrownBlue’, ‘Dark’, ‘Dark2’, ‘DarkAmber’, ‘DarkBlack’, ‘DarkBlack1’, ‘DarkBlue’, ‘DarkBlue1’, ‘DarkBlue10’, ‘DarkBlue11’, ‘DarkBlue12’, ‘DarkBlue13’, ‘DarkBlue14’, ‘DarkBlue15’, ‘DarkBlue16’, ‘DarkBlue17’, ‘DarkBlue2’, ‘DarkBlue3’, ‘DarkBlue4’, ‘DarkBlue5’, ‘DarkBlue6’, ‘DarkBlue7’, ‘DarkBlue8’, ‘DarkBlue9’, ‘DarkBrown’, ‘DarkBrown1’, ‘DarkBrown2’, ‘DarkBrown3’, ‘DarkBrown4’, ‘DarkBrown5’, ‘DarkBrown6’, ‘DarkGreen’, ‘DarkGreen1’, ‘DarkGreen2’, ‘DarkGreen3’, ‘DarkGreen4’, ‘DarkGreen5’, ‘DarkGreen6’, ‘DarkGrey’, ‘DarkGrey1’, ‘DarkGrey2’, ‘DarkGrey3’, ‘DarkGrey4’, ‘DarkGrey5’, ‘DarkGrey6’, ‘DarkGrey7’, ‘DarkPurple’, ‘DarkPurple1’, ‘DarkPurple2’, ‘DarkPurple3’, ‘DarkPurple4’, ‘DarkPurple5’, ‘DarkPurple6’, ‘DarkRed’, ‘DarkRed1’, ‘DarkRed2’, ‘DarkTanBlue’, ‘DarkTeal’, ‘DarkTeal1’, ‘DarkTeal10’, ‘DarkTeal11’, ‘DarkTeal12’, ‘DarkTeal2’, ‘DarkTeal3’, ‘DarkTeal4’, ‘DarkTeal5’, ‘DarkTeal6’, ‘DarkTeal7’, ‘DarkTeal8’, ‘DarkTeal9’, ‘Default’, ‘Default1’, ‘DefaultNoMoreNagging’, ‘Green’, ‘GreenMono’, ‘GreenTan’, ‘HotDogStand’, ‘Kayak’, ‘LightBlue’, ‘LightBlue1’, ‘LightBlue2’, ‘LightBlue3’, ‘LightBlue4’, ‘LightBlue5’, ‘LightBlue6’, ‘LightBlue7’, ‘LightBrown’, ‘LightBrown1’, ‘LightBrown10’, ‘LightBrown11’, ‘LightBrown12’, ‘LightBrown13’, ‘LightBrown2’, ‘LightBrown3’, ‘LightBrown4’, ‘LightBrown5’, ‘LightBrown6’, ‘LightBrown7’, ‘LightBrown8’, ‘LightBrown9’, ‘LightGray1’, ‘LightGreen’, ‘LightGreen1’, ‘LightGreen10’, ‘LightGreen2’, ‘LightGreen3’, ‘LightGreen4’, ‘LightGreen5’, ‘LightGreen6’, ‘LightGreen7’, ‘LightGreen8’, ‘LightGreen9’, ‘LightGrey’, ‘LightGrey1’, ‘LightGrey2’, ‘LightGrey3’, ‘LightGrey4’, ‘LightGrey5’, ‘LightGrey6’, ‘LightPurple’, ‘LightTeal’, ‘LightYellow’, ‘Material1’, ‘Material2’, ‘NeutralBlue’, ‘Purple’, ‘Reddit’, ‘Reds’, ‘SandyBeach’, ‘SystemDefault’, ‘SystemDefault1’, ‘SystemDefaultForReal’, ‘Tan’, ‘TanBlue’, ‘TealMono’, ‘Topanga’]

Let’s see the Python Code For changing the theme of the GUI created dynamically with built-in PySimpleGUI Themes.

Below is the implementation.

# import PySimpleGUI
import PySimpleGUI as sg
# Choose a Theme for the Layout
layout = [[sg.Text('List of InBuilt Themes')],
          [sg.Text('Please Choose a Theme  to see Demo window')],
          [sg.Listbox(values = sg.theme_list(),
                      size =(20, 12),
                      key ='-LIST-',
                      enable_events = True)],
window = sg.Window('Theme List', layout)
# This is an Event Loop
while True:  
    event, values =
    if event in (None, 'Exit'):
    sg.popup_get_text('This is {}'.format(values['-LIST-'][0]))
# Close


Last Updated : 17 May, 2020
Like Article
Save Article
Similar Reads
Related Tutorials