[Enhancement] Problems while using custom TTK Themes
Type of Issue (Enhancement, Error, Bug, Question)
Bug
Operating System
Windows 10 x64 (21H2)
PySimpleGUI Port (tkinter, Qt, Wx, Web)
tkinter
Versions
Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()
Python version (sg.sys.version)
3.8.6 x64
PySimpleGUI Version (sg.__version__)
4.60.0
GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)
8.6.9
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [X]
- [X] Searched main docs for your problem www.PySimpleGUI.org
- [X] Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
- [ ] If not tkinter - looked for Demo Programs for specific port
- [ ] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
- [X] Run your program outside of your debugger (from a command line)
- [X] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
- [x] Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
- [x] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description
When using a third-party TTK theme ttkboostrap- the program crashes with a message that this theme is not included in the list of allowed. Therefore, the program does not support the import of third-party themes that would be suitable in using my program. Perhaps it all comes down to using a third-party TTK library that needs to be imported into the PySimpleGUI base module, but I would like to see at least some support for third-party themes, including inaccessible embedded ones
Code To Duplicate
import ttkbootstrap as ttk
...
updateWindow = sg.Window('Home center', update, no_titlebar=True, keep_on_top=True, font='Arial', background_color='#0a0f14', ttk_theme='darkly', use_ttk_buttons=True).Finalize()
Screenshot, Sketch, or Drawing
https://ibb.co/zbBH398
Watcha Makin?
Home server GUI project (for client PC)
If you care to share something about your project, it would be awesome to hear what you're building.
PySimpleGUI is capable of integrating with custom themes like plastik, TTK-Azure, etc. They're going to be of limited value since not all of the elements use TTK widgets. I've spoken with Israel, the author of ttkbootstrap and it's not designed like these other themes. It's more of a custom GUI framework that's on top of tkinter. In many ways, it would be a custom port. I would check with him to get his opinion on how to go about integrating the 2 if that's something you're after. But again, you'll only have partial integration since TK elements are in use for Sliders for example.
The approach I've taken is to be more portable overall and making it easier to customize windows not by changing the underlying button widget, but by using PIL, images, etc. The Graph element is an easy way of implementing completely custom widgets/elements. A Qt-Style Dial is shown in the Udemy course as an example. The theory is that an element written in this manner will be portable across all ports of PySimpleGUI.
I have not posted a Demo Program for custom TTK themes as I don't believe they're worth using without first moving some of the elements over to TTK. It felt like 1/2 of an integration and thus it's not posted.
Should we expect to introduce support for more TTK widgets in PySimpleGUI in the future? Considering that they are not available on all ports (although the main work is done on tkinter)
It's certainly on the list of improvements to the tkinter port.
Option ttk_theme is not the same thing as the themes used in PySimpleGUI or in ttkbootstrap.
ttk themes (which are a collection of styles that define how all the widgets in your application look). Changing themes can give your application an entirely different look.
The themes used in PySimpleGUI or in ttkbootstrap, just for the colors. not the different look.
The definition of themes in PySimpleGUI or in ttkbootstrap are different, so they cannot be used directly.
In ttkbootstrap,
"darkly": {
"type": "dark",
"colors": {
"primary": "#375a7f",
"secondary": "#444444",
"success": "#00bc8c",
"info": "#3498db",
"warning": "#f39c12",
"danger": "#e74c3c",
"light": "#ADB5BD",
"dark": "#303030",
"bg": "#222222",
"fg": "#ffffff",
"selectbg": "#555555",
"selectfg": "#ffffff",
"border": "#222222",
"inputfg": "#ffffff",
"inputbg": "#2f2f2f",
"active": "#1F1F1F",
},
},
In PySimpleGUI,
"Dark": {"BACKGROUND": "#404040", "TEXT": "#FFFFFF", "INPUT": "#4D4D4D", "TEXT_INPUT": "#FFFFFF", "SCROLL": "#707070", "BUTTON": ("#FFFFFF", "#004F00"),
@jason990420, thanks for the explanation
