Skip to content

feat(instructions): add Python Tkinter & CustomTkinter GUI development guidelines 🤖🤖🤖 - #6432

Open
jaideepkrishna2008-ui wants to merge 4 commits into
github:mainfrom
jaideepkrishna2008-ui:add-python-tkinter-gui-instructions
Open

jaideepkrishna2008-ui wants to merge 4 commits into
github:mainfrom
jaideepkrishna2008-ui:add-python-tkinter-gui-instructions

Conversation

@jaideepkrishna2008-ui

Copy link
Copy Markdown

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have read and followed the Guidance for submissions involving paid services.
  • 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.

Copilot AI adaptive review requested due to automatic review settings November 15, 2026 07:34
@github-actions github-actions Bot added instructions PR touches instructions new-submission PR adds at least one new contribution labels Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔒 PR Risk Scan Results

Scanned 1 changed file(s).

Severity Count
🔴 High 0
🟠 Medium 0
ℹ️ Info 0

✅ No matching risk patterns were detected in changed files.

This is an automated soft-gate report. Findings indicate review targets and do not block merge by themselves.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🚦 Submission status: 🛠️ Requires submitter fixes

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
  • Changes 231 lines (low-risk limit is 40)

Automated checks

Check Status Details
Line endings ✅ Passed Passed · logs
Spelling ✅ Passed Passed · logs
Generated README consistency ✅ Passed Passed · logs
Risk scan ✅ Passed Passed · logs
Contributor reputation ✅ Passed Passed · logs
Duplicate resource scan ✅ Passed Passed · logs
PR quality signal ⏭️ Skipped Skipped by its workflow · logs

Action needed

  • Address the changes requested by aaronpowell, then push an update.

Review

  • Approvals: 0/1
  • Assigned reviewer: not assigned yet — comment /request-review to ask for one
  • Review target date: not set
  • Still needed: 1 more approval(s); resolution of changes requested by aaronpowell
  • No staffed reviewer pool owns these files yet; any reviewer with write access counts as the domain reviewer.

Commands

Command Who What it does
/rerun-checks PR author, maintainers Re-runs failed or incomplete checks and re-evaluates this gate
/request-review PR author, maintainers Asks the review rotation to assign a reviewer (adds needs-reviewer)

Updated for 07a3d02 · gate run · This comment is maintained automatically — see submission gate docs.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Contributor Reputation Check: MEDIUM risk

Check Risk
Profile MEDIUM
Credential audit NONE

Maintainers: please review this contributor before merging.
See the workflow run for full details.
Automated check powered by AGT.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor reputation check flagged MEDIUM risk label Nov 15, 2026
@github-actions github-actions Bot added ready-for-review Submission passed intake validation and is ready for maintainer review and removed awaiting-automation labels Nov 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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.

7 open issues
What changed in this PR

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.

Review effort: Lite (dynamic)

- 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
Copilot AI adaptive review requested due to automatic review settings November 15, 2026 08:14
@jaideepkrishna2008-ui

Copy link
Copy Markdown
Author

/request-review

@github-actions github-actions Bot added awaiting-automation and removed ready-for-review Submission passed intake validation and is ready for maintainer review labels Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🙋 Added needs-reviewer. Reviewer routing is assigning a reviewer now.

@github-actions github-actions Bot added ready-for-review Submission passed intake validation and is ready for maintainer review and removed awaiting-automation labels Nov 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aaronpowell aaronpowell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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.

@github-actions github-actions Bot added requires-submitter-fixes Submission has quality-gate findings that submitter must fix before maintainer review and removed ready-for-review Submission passed intake validation and is ready for maintainer review labels Nov 17, 2026
…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.
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 15:03
@jaideepkrishna2008-ui

Copy link
Copy Markdown
Author

Thanks for the feedback, @aaronpowell! I've updated the examples and guidelines:

  1. 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().
  2. 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).
  3. 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.

@jaideepkrishna2008-ui

Copy link
Copy Markdown
Author

/rerun-checks

@github-actions

Copy link
Copy Markdown
Contributor

🔁 /rerun-checks for afc2c3e

Re-running: Submission Gate.

The status comment updates when the checks finish.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The change still contains three active documentation issues affecting snippet usability, theme consistency, and bounded GUI shutdown behavior.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Set the theme before constructing the root

instructions/​python-tkinter-gui.instructions.md:176

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__()).

4 resolved since last review

Review effort: Lite (adaptive)

…st block indentation

- Add 2000ms bounded timeout fallback to _wait_for_workers_and_destroy to prevent hanging if workers ignore cancellation.
- Indent nested fenced code block lines consistently within High-DPI list item.
Copilot AI adaptive review requested due to automatic review settings November 21, 2026 08:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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.

No open issues 🎉

2 resolved since last review

Review effort: Lite (adaptive)

@jaideepkrishna2008-ui

Copy link
Copy Markdown
Author

/rerun-checks

@github-actions

Copy link
Copy Markdown
Contributor

🔁 /rerun-checks for 07a3d02

No failed or incomplete checks to re-run.

  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

instructions PR touches instructions merge-risk:medium needs-review:MEDIUM Contributor reputation check flagged MEDIUM risk needs-reviewer new-submission PR adds at least one new contribution requires-submitter-fixes Submission has quality-gate findings that submitter must fix before maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants