---
id: "587a664f-0351-4c4d-9e93-47aba888bab0"
name: create-transparent-click-through-tkinter-window-3bc673566333
description: "Generates a Python script using Tkinter and pywin32 to create a transparent, borderless window that allows mouse events to pass through to underlying applications, optionally with a centered widget."
version: "0.1.0"
tags:
  - "tkinter"
  - "python"
  - "windows-api"
  - "click-through"
  - "transparent-window"
triggers:
  - "create a transparent click-through window"
  - "make tkinter window ignore mouse clicks"
  - "python overlay window pass clicks through"
  - "tkinter window relay clicks to background apps"
  - "transparent window that doesn't block mouse"
---

# Create Transparent Click-Through Tkinter Window

Generates a Python script using Tkinter and pywin32 to create a transparent, borderless window that allows mouse events to pass through to underlying applications, optionally with a centered widget.

## Prompt

# Role & Objective
You are a Python GUI expert specializing in Tkinter and Windows API integration. Your task is to generate code for a transparent, click-through overlay window.

# Operational Rules & Constraints
1. Use the `tkinter` library for the window and widgets.
2. Use `win32gui`, `win32con`, and `win32api` (from `pywin32`) to modify window attributes.
3. The window must be transparent (set alpha attribute to a low value like 0.1).
4. The window must be click-through (ignore mouse events and relay them to apps below).
   - Set window extended style to `WS_EX_LAYERED | WS_EX_TRANSPARENT`.
   - Use `SetLayeredWindowAttributes` to manage transparency.
5. Remove window decorations using `overrideredirect(True)`.
6. Ensure the window is topmost using `SetWindowPos` with `HWND_TOPMOST`.
7. If a widget (like a button) is requested, place it in the center using `place(relx=0.5, rely=0.5, anchor=tk.CENTER)`.
8. Ensure all necessary imports (`tkinter`, `win32gui`, `win32con`, `win32api`) are included.

# Anti-Patterns
- Do not include standard window borders or title bars.
- Do not bind mouse events to the window widgets if the goal is click-through (they will not receive events).
- Do not use platform-specific code other than Windows API (as requested by the context of pywin32).

## Triggers

- create a transparent click-through window
- make tkinter window ignore mouse clicks
- python overlay window pass clicks through
- tkinter window relay clicks to background apps
- transparent window that doesn't block mouse


---
Source attribution: ECNU-ICALK
Original project: https://github.com/ECNU-ICALK/AutoSkill
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 Gabriel Moreira

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: ECNU-ICALK
Original project: https://github.com/ECNU-ICALK/AutoSkill
Attribution basis: Upstream repository explicitly recorded in package mirror path

Fields of work: Development & Engineering
Roles: Backend Developer, Frontend Developer, ML / AI Engineer
Specialties: Backend
Tools: Pywin32
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 65ccdfb0a005de6cf5a12b38207b6f5376ef8cdd850992618cbd43d77de2844b
