-
Notifications
You must be signed in to change notification settings - Fork 9
Fix/155 windows default skin #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kujirahand
wants to merge
9
commits into
main
Choose a base branch
from
fix/155-windows-default-skin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ae504d1
feat(theme): improve Windows UI defaults and add theme guide
kujirahand ccf73a8
change default parameter: use_ttk_button=True
kujirahand b5204dd
Potential fix for pull request finding
kujirahand 9e16a22
Potential fix for pull request finding
kujirahand 59346f2
fix: add get_themes alias and update theme guide naming
Copilot 93566a4
Merge branch 'main' of github.com:kujirahand/tkeasygui-python into fi…
kujirahand b81101d
merge main
kujirahand 771bc76
Merge branch 'fix/155-windows-default-skin' of github.com:kujirahand/…
kujirahand 7b3babf
set use_ttk_buttons
kujirahand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| # TkEasyGUI Theme Guide | ||
|
|
||
| This document explains how to use themes and how to change theme-related defaults in TkEasyGUI. | ||
|
|
||
| ## Overview | ||
|
|
||
| TkEasyGUI uses `ttk` themes for modern widget rendering. | ||
| You can switch themes at runtime using `set_theme()` or `theme()`. | ||
|
|
||
| Default theme by platform: | ||
|
|
||
| - macOS: `aqua` | ||
| - Windows: `vista` | ||
| - Linux/others: `clam` | ||
|
|
||
| ## Basic theme usage | ||
|
|
||
| ### Change theme with `set_theme` | ||
|
|
||
| ```python | ||
| import TkEasyGUI as eg | ||
|
|
||
| eg.set_theme("clam") | ||
| window = eg.Window("Theme sample", [[eg.Button("OK", use_ttk_buttons=True)]]) | ||
| window.read() | ||
| window.close() | ||
| ``` | ||
|
|
||
| ### Alias: `theme` | ||
|
|
||
| `theme()` is an alias of `set_theme()`. | ||
|
|
||
| ```python | ||
| import TkEasyGUI as eg | ||
|
|
||
| eg.theme("default") | ||
| ``` | ||
|
|
||
| ## List available themes | ||
|
|
||
| Use `get_tnemes()` to inspect themes available in your current Tk runtime. | ||
|
|
||
| ```python | ||
| import TkEasyGUI as eg | ||
|
|
||
| print(eg.get_tnemes()) | ||
|
kujirahand marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| Note: | ||
| - Function name is `get_tnemes()` in current API. | ||
|
|
||
| ## Change button style behavior | ||
|
|
||
| `Button` can render with `ttk.Button` (modern) or `tk.Button` (classic). | ||
|
|
||
| - `use_ttk_buttons=True`: use `ttk.Button` | ||
| - `use_ttk_buttons=False`: use `tk.Button` | ||
| - `use_ttk_buttons=None` (default): Windows uses `ttk`, other OS keep previous default behavior | ||
|
kujirahand marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```python | ||
| import TkEasyGUI as eg | ||
|
|
||
| layout = [ | ||
| [eg.Button("Modern", use_ttk_buttons=True)], | ||
| [eg.Button("Classic", use_ttk_buttons=False)], | ||
| ] | ||
| window = eg.Window("Buttons", layout) | ||
| window.read() | ||
| window.close() | ||
| ``` | ||
|
|
||
| Note: | ||
| - If you set `use_ttk_buttons=True`, explicit button height settings are ignored. | ||
| - This is a limitation of `ttk`. | ||
| - If you need to control button height, use `use_ttk_buttons=False`. | ||
|
|
||
|
|
||
|
|
||
|
|
||
| ## How to customize defaults | ||
|
|
||
| ### Global theme default | ||
|
|
||
| If you want to change the default theme for your app, call `set_theme()` before creating windows. | ||
|
|
||
| ```python | ||
| import TkEasyGUI as eg | ||
|
|
||
| eg.set_theme("winnative") | ||
| ``` | ||
|
|
||
| ### Revert to old Windows look | ||
|
|
||
| If you want behavior close to older Windows appearance: | ||
|
|
||
| ```python | ||
| import TkEasyGUI as eg | ||
|
|
||
| eg.set_theme("vista") | ||
| layout = [[eg.Button("OK", use_ttk_buttons=False)]] | ||
| window = eg.Window("Legacy look", layout) | ||
| window.read() | ||
| window.close() | ||
| ``` | ||
|
|
||
| ## Recommended test scripts | ||
|
|
||
| After changing theme defaults, validate with: | ||
|
|
||
| ```bash | ||
| python tests/file_viewer.py | ||
| python tests/theme/ttk_button.py | ||
| python tests/ui_test.py | ||
| python tests/many_buttons.py | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| """Compare ttk and classic button rendering.""" | ||
|
|
||
| import TkEasyGUI as eg | ||
|
|
||
| layout = [ | ||
| [eg.Text("This is a modern button using ttk styles.")], | ||
| [eg.Button("Modern", use_ttk_buttons=True)], | ||
| [eg.HSeparator()], | ||
| [eg.Text("This is a classic button using Tkinter styles.")], | ||
| [eg.Button("Classic", use_ttk_buttons=False)], | ||
| ] | ||
| window = eg.Window("Buttons", layout) | ||
| for event, values in window.event_iter(): | ||
| if event == "Modern": | ||
| eg.popup("You clicked the modern button!") | ||
| if event == "Classic": | ||
|
kujirahand marked this conversation as resolved.
Outdated
|
||
| eg.popup("You clicked the classic button!") | ||
| window.close() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.