You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My contribution adds a new instruction, prompt, agent, skill, workflow, or canvas extension file in the correct directory.
The file follows the required naming convention (instructions/python-tkinter-gui.instructions.md).
The content is clearly structured and follows the example format.
I have tested my instructions, prompt, agent, skill, workflow, or canvas extension with GitHub Copilot.
I have run npm start and verified that README.md / docs/README.instructions.md is up to date.
I am targeting the main branch for this pull request.
Description
Adds dedicated Copilot instructions for modern Python desktop GUI development using tkinter and customtkinter:
Threading & Event Loop Architecture: Enforces non-blocking execution via worker threads/asyncio and thread-safe UI scheduling with root.after() and queue.Queue.
Layout & Geometry Consistency: Prevents layout manager collision (never mixing grid() and pack() in the same container) and specifies high-DPI scaling awareness for Windows/macOS.
Win32 & Canvas Integration: Best practices for canvas stacking, event propagation (return "break"), and frameless/custom window controls.
Modern Styling with CustomTkinter: Color-tuple themes, consistent corner radius, and DPI-responsive components.
Resource Cleanup: Window close protocols (WM_DELETE_WINDOW) and image reference preservation to prevent garbage collection bugs.
Risk tier:merge-risk:medium — New or substantially changed resource without privileged execution Required to merge: passing submission-gate checks plus 1 approval from reviewers with write access.
Why this tier
Adds 1 file(s), e.g. instructions/python-tkinter-gui.instructions.md
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Several moderate issues remain in the Tkinter guidance, including incorrect API usage, invalid syntax, and incomplete shutdown, async, window-ownership, and multi-monitor recommendations.
Adds a new context-aware instruction set for Python Tkinter and CustomTkinter GUI development, covering responsiveness, layout, styling, window integration, and lifecycle management, and registers it in the generated instructions catalog.
Changes:
Added threading, event-loop, geometry, DPI, canvas, styling, and cleanup guidance with examples.
Added the new instruction to docs/README.instructions.md.
File
Description
instructions/python-tkinter-gui.instructions.md
Adds Python Tkinter and CustomTkinter development guidelines covering threading, layout, DPI awareness, canvas behavior, styling, window integration, and cleanup.
docs/README.instructions.md
Registers the new Python Tkinter and CustomTkinter instruction in the repository's generated instructions catalog.
- clarify asyncio vs mainloop non-blocking integration
- fix geometry manager conflict explanation to TclError
- specify tag_raise vs lift distinction for canvas items and widgets
- improve multi-monitor boundary querying recommendation
- use proper prose notation for appearance modes and themes
- distinguish CTk main root window from CTkToplevel child windows
- implement cooperative worker cancellation and after timer cleanup
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The change retains three active documentation issues: misleading modality and DPI-awareness comments, plus a cleanup example that destroys the Tk interpreter before the worker has exited.
The reason will be displayed to describe this comment to others. Learn more.
Please update the examples before merging: in on_closing, don't destroy the root immediately after setting the cancellation event—wait for the worker to finish (without blocking the UI) before destroying Tk. In the DPI example, use the actual per-monitor awareness value/API or rename the behavior to system-DPI-aware. Also clarify that transient() only establishes window ownership/stacking; grab_set() is what makes the shown dialog modal.
…wareness, and modality
Address review requests from @aaronpowell:
- In on_closing, poll active worker threads via after() without blocking the UI mainloop before calling destroy().
- Update Windows DPI example to PROCESS_PER_MONITOR_DPI_AWARE (2) with fallback to system-DPI-aware.
- Clarify that transient(parent) establishes window ownership/stacking, while grab_set() makes the dialog modal.
Thanks for the feedback, @aaronpowell! I've updated the examples and guidelines:
Non-blocking worker shutdown in on_closing:
Updated the cleanup lifecycle to set stop_event, cancel pending after() callbacks, and poll _wait_for_workers_and_destroy via after(50, ...) without blocking the UI event loop until worker threads exit before calling destroy().
Per-monitor DPI awareness:
Updated the Windows DPI initialization example to use SetProcessDpiAwareness(2) (PROCESS_PER_MONITOR_DPI_AWARE) with a graceful fallback to SetProcessDPIAware() (system-DPI-aware).
Dialog modality & window ownership:
Clarified in both code comments and the guideline text that transient(parent) establishes window ownership and stacking order relative to the parent, while grab_set() directs all input events to make the shown dialog modal.
CTk is constructed before the global appearance and theme settings are applied. set_default_color_theme() is used when widgets are initialized, so changing this example from the default blue to dark-blue, green, or a custom theme can leave the root using the old theme while later controls use the new one. Apply these settings before constructing the root (for example, before super().__init__()).
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because the instruction’s broad activation scope and incomplete macOS guidance may cause unintended conflicts and leave platform coverage ambiguous.
Submission Gate waiting for a maintainer to approve workflow runs.
The status comment updates when the checks finish.
This branch has not been deployed
No deployments
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
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.
Pull Request Checklist
instructions/python-tkinter-gui.instructions.md).npm startand verified thatREADME.md/docs/README.instructions.mdis up to date.mainbranch for this pull request.Description
Adds dedicated Copilot instructions for modern Python desktop GUI development using
tkinterandcustomtkinter:root.after()andqueue.Queue.grid()andpack()in the same container) and specifies high-DPI scaling awareness for Windows/macOS.return "break"), and frameless/custom window controls.WM_DELETE_WINDOW) and image reference preservation to prevent garbage collection bugs.