Web Analytics Made Easy - Statcounter
Skip to content

Modifying an existing Theme

Let's say you like the LightGreeen3 Theme, except you would like for the buttons to have black text instead of white. You can change this by modifying the theme at runtime.

Normal use of theme calls is to retrieve a theme's setting such as the background color. The functions used to retrieve a theme setting can also be used to modify the setting by passing in the new setting as a parameter.

Calling theme_background_color() returns the background color currently in use. Passing in the color 'blue' as the parameter, theme_background_color('blue'), will change the background color for future windows you create to blue.

import PySimpleGUI as sg

sg.popup_no_wait('This is the standard LightGreen3 Theme', 'It has white button text')

# Modify the theme 
sg.theme_button(('black', '#6D9F85'))

sg.popup('This is the modified LightGreen3 Theme', 'It has black button text')

Produces these 2 windows