Skip to main content

Instantaneous theme changing for PySimpleGUI windows.

Project description

Reskinner Plugin for PySimpleGUI

pip install PSG-Reskinner

https://github.com/definite-d/psg_reskinner.

What's Reskinner?

Reskinner is a Python 3 plugin for PySimpleGUI's Tkinter port which enables changing the theme of a PySimpleGUI window on the fly without the need for re-instantiating the window.

Example Usage (Demo)

import PySimpleGUI as sg
from PSG_Reskinner import reskin

window_layout = [
        [sg.Text('Hello! You are currently running Reskinner instead of importing it.')],
        [sg.Text('Clicking the button will change the theme to the one specified.')],
        [sg.Text('Or do nothing. The theme will change every few seconds')],
        [sg.DropDown(values=sg.theme_list(), default_value='DarkBlue3', k='new_theme')],
        [sg.Button('Change Theme', k='change')],
    ]

    window = sg.Window('Reskinner Demo', window_layout, element_justification='center')

    while True:

        e, v = window.Read(timeout=3000)

        if e in (None, 'Exit'):
            window.Close()
            break

        if e == 'change':
            reskin(window, v['new_theme'])

        else:
            reskin(window, rc(sg.theme_list()))

How does it work?

Reskinner runs through each element in a window, then by relying on the Element.Widget interface to access the underlying Tkinter object, it applies style changes to the window.

What's the story behind psg_reskinner?

Like Unda, I created Reskinner to be a part/feature of a desktop application which I'm developing, however, I decided to open-source it, as I imagined other developers would find such functionality useful in their projects as well.

Development began on Monday 15th August 2022.

Why is it called Reskinner?

I didn't want it to conflict with the built-in conventions of theme and look_and_feel that PySimpleGUI has.

Standards

Reskinner is:

  • lightweight (about 4KB in size)

  • built using Python 3.7 (in PyCharm),

  • fully PEP-8 compliant,

  • distributed under the OSI-Approved MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PSG_Reskinner-1.0.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

PSG_Reskinner-1.0.0-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page