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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for PSG_Reskinner-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95d5f15ff41d116f34d63403882b456743e4c8bc288335a11a67fa1484f84f20 |
|
MD5 | c48127c9e981d470cb37796d6e48a989 |
|
BLAKE2b-256 | c9fd334489f777ddd5015419f6c5e263f56f2acd21036b514399c2a659095ac8 |