An open API service indexing awesome lists of open source software.

https://github.com/fluxswitch/dpg-customwindow

A custom window bar template base on dearpygui
https://github.com/fluxswitch/dpg-customwindow

custom customwindows dearpygui style window

Last synced: 5 months ago
JSON representation

A custom window bar template base on dearpygui

Awesome Lists containing this project

README

          

# CustomWindow (Dear PyGui Framework)
A desktop application framework for a custom borderless window, built on Dear PyGui. It provides:
- Custom title bar (icon, title text, minimize/maximize/close)
- Borderless window dragging with edge/corner resize overlay
- Windows API cursor switching and window controls (fallback to Dear PyGui behaviors on non‑Windows)
- Centralized event handling in the `UIEvent` class; user UI is composed via `UserUI` into `UIHandle`
- An independent window snap system(Because of the borderless configuration, the Windows Snap feature can only operate in an independent manner.)

## Demo
| Original windows window bar | CustomWindow (This Project) |
|------------------------|----------------------------------|
| image | image |

https://github.com/user-attachments/assets/6bc74125-9d9d-42f5-8163-759e0bab0119

## Why
Since Dear PyGui currently lacks a simple, mature custom window bar solution on Windows, I built one for future development.
Feel free to fork it if you need it.
This project was completed using vibe coding techniques.
Please note that the code is VERY messy, but I have prepared a way for you to use it (see the following explanation about UserUI).
If you want to customize the window bar yourself, the following elements are customizable:
1. icon (please modify the icon image)
2. title text and the title bar color(please modify the item's color theme and text with tag "title_text_btn")
3. minimize/maximize/close window buttons (please modify the corresponding images)
4. Some custom window constants

## Installation

Install dependencies with pip (virtual environment recommended):

```bash
pip install -r requirement.txt
# or
pip install dearpygui
```

## Run

Start the default window provided by the framework:

```bash
python CustomWindow.py
```

## Important Settings

- `CUSTOMWINDOW_DEBUG`: When enabled, shows resize boundaries and button hover/active colors to aid debugging.
- Layout behavior: The default main content window `content_window` automatically avoids the title bar and resize margins.

## Platform Notes

- Windows only: Uses WinAPI for controls (minimize/maximize/cursor switching) and offers the best experience.

## Project Structure (summary)

```
CustomWindow.py # Main framework file with UIHandle / UIEvent / ResizeOverlay / CustomWindowBar / UserUI
fonts/ # Font assets (optional)
icon/ # Window icon assets (optional)
images/ # Image assets (optional)
resources/Resource.drawio
```

## Development Tips

- If you want a simpler approach, please use the UserUI class for development.
- To integrate more events, add methods in the `UIEvent` class and bind corresponding handlers in your layout.