hPyT


NamehPyT JSON
Version 1.3.5 PyPI version JSON
download
home_pagehttps://github.com/zingzy/hPyT
SummaryHack Python Titlebar - A package to manipulate windows and titlebar of GUI applications made using python.
upload_time2024-11-28 00:19:52
maintainerNone
docs_urlNone
authorzingzy
requires_python>=3.6
licenseMIT
keywords tkinter wxpython pyqt pyside gui window controls decorations hide show titlebar border color animation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # hPyT - Hack Python Titlebar

A package to manipulate windows and titlebar of GUI applications made using python
**Supports Both Windows 11 and 10**

https://github.com/Zingzy/hPyT/assets/90309290/f86df1c7-b75b-4477-974a-eb34cc117df3

**You can download the above app from the [github releases](https://github.com/Zingzy/hPyT/releases/tag/hPyT-preview/) to test out the package before installing/using it in your projects**

<br>

<details>

<summary>📖 Table of Contents</summary>

- [hPyT - Hack Python Titlebar](#hpyt---hack-python-titlebar)
	- [📚 Supported Libraries](#-supported-libraries)
	- [📦 Installing](#-installing)
	- [📥 Importing](#-importing)
	- [Hide/Unhide Title Bar](#hideunhide-title-bar)
	- [🌈 Rainbow TitleBar](#-rainbow-titlebar)
	- [🌈 Rainbow Border](#-rainbow-border)
		- [🔄 Synchronizing the Rainbow Effect with other elements](#-synchronizing-the-rainbow-effect-with-other-elements)
	- [Hide/Unhide both Maximize and Minimize Buttons (Completely Hides both buttons)](#hideunhide-both-maximize-and-minimize-buttons-completely-hides-both-buttons)
	- [Hide/Unhide All Buttons or Stuffs](#hideunhide-all-buttons-or-stuffs)
	- [Enable/Disable Maximize Button](#enabledisable-maximize-button)
	- [Enable/Disable Minimize Button](#enabledisable-minimize-button)
	- [Opacity](#opacity)
	- [⚡ Flashing Window](#-flashing-window)
	- [🎨 Custom TitleBar Color](#-custom-titlebar-color)
		- [Set TitleBar Color to windows Accent Color](#set-titlebar-color-to-windows-accent-color)
	- [🖌️ Custom TitleBar Text Color](#️-custom-titlebar-text-color)
	- [🖌️ Custom Border Color](#️-custom-border-color)
		- [Set Border Color to windows Accent Color](#set-border-color-to-windows-accent-color)
	- [💻 Window Management](#-window-management)
		- [Center a window on the screen](#center-a-window-on-the-screen)
		- [Center a secondary window relative to the primary window](#center-a-secondary-window-relative-to-the-primary-window)
		- [Other basic window management functions](#other-basic-window-management-functions)
	- [✨ Window Animations](#-window-animations)
		- [Circle Motion](#circle-motion)
		- [Verical Shake](#verical-shake)
		- [Horizontal Shake](#horizontal-shake)
	- [✏️ Stylize text](#️-stylize-text)
	- [Miscellaneous](#miscellaneous)
	- [Get Windows Accent Color](#get-windows-accent-color)
	- [Stylize text](#stylize-text)
	- [Workaround for other libraries](#workaround-for-other-libraries)
	- [📜 hPyT Changelog](#-hpyt-changelog)
		- [v1.3.5](#v135)
		- [v1.3.4](#v134)
		- [v1.3.3](#v133)
		- [v1.3.2](#v132)
		- [v1.3.1](#v131)
		- [v1.3.0](#v130)
		- [v1.2.1](#v121)
		- [v1.2.0](#v120)
		- [v1.1.3](#v113)
		- [v1.1.2](#v112)
		- [v1.1.1](#v111)
		- [v1.1.0](#v110)
</details>

---

## 📚 Supported Libraries

- Tkinter & CustomTkinter
- PyQt
- PySide
- WxPython
- Kivy
- And many more

## 📦 Installing

```powershell
pip install hPyT==1.3.5
```

## 📥 Importing

```python
from hPyT import *
from customtkinter import * # you can use any other library from the above mentioned list

window = CTk() # creating a window using CustomTkinter
```

## Hide/Unhide Title Bar

```python
title_bar.hide(window) # hides full titlebar
# title_bar.unhide(window)
```

![image](https://github.com/littlewhitecloud/hPyT/assets/71159641/03e533fe-c42a-4d84-b138-176a73ad7977)

## 🌈 Rainbow TitleBar

```python
rainbow_title_bar.start(window, interval=5) # starts the rainbow titlebar
# rainbow_title_bar.stop(window) # stops the rainbow titlebar
```

> [!NOTE]
> *`interval` is the time in milliseconds in which the color would change*

![Rainbow TitleBar](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/rainbow_titlebar.gif)

## 🌈 Rainbow Border

```python
rainbow_border.start(window, interval=4) # starts the rainbow border
# rainbow_border.stop(window) # stops the rainbow border
```

![Rainbow Border](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/rainbow_border.gif)

### 🔄 Synchronizing the Rainbow Effect with other elements

```python
from hPyT import *

...

rainbow_title_bar.start(window, interval=30) # starts the rainbow titlebar
# rainbow_border.start(window, interval=30) # also works with rainbow border

current_color = rainbow_title_bar.get_current_color() # or rainbow_border.get_current_color()
# you can use this color to synchronize the color of other elements with the titlebar
```

![synchronization example](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/synchronization-example.gif)


**Code for the above illustration available in [`/examples/rainbow-synchronization-example.py`](https://github.com/Zingzy/hPyT/blob/main/examples/rainbow-synchronization-example.py)**


## Hide/Unhide both Maximize and Minimize Buttons (Completely Hides both buttons)

```python
maximize_minimize_button.hide(window) # hides both maximize and minimize button
# maximize_minimize_button.unhide(window)
```

![Hidden Maximize and Minimize Buttons](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/maximize_minimize.png)

## Hide/Unhide All Buttons or Stuffs

```python
all_stuffs.hide(window) # hides close button
# all_stuffs.unhide(window)
```

![Hide Everything](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/all_stuffs.png)

_**Tip:** to hide the text set the window title to `''`_

## Enable/Disable Maximize Button

```python
maximize_button.disable(window) # hides maximize button
# MaximizeButton.enable(window)
```

![Disabled Maximize Button](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/maximize.png)

## Enable/Disable Minimize Button

```python
minimize_button.disable(window) # hides minimize button
# MinimizeButton.enable(window)
```

![Disabled Minimize Button](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/minimize.png)

## Opacity

```python
opacity.set(window, 0.5) # sets the window opacity to 50%
# opacity.set(window, 1) # resets the window opacity to 100%
```

![Opacity 0.5 preview](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/opacity.png)

## ⚡ Flashing Window

```python
window_flash.flash(window, 10, 100) # flashes the window 10 times with 100ms interval
# window_flash.stop(window) # stops the flashing immediately
```

*Flashing Interval starts from 10ms, **default 1000ms***

![Flashing Window](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/flashing.gif)

## 🎨 Custom TitleBar Color

```python
title_bar_color.set(window, '#ff00ff') # sets the titlebar color to magenta
# title_bar_color.reset(window) # resets the titlebar color to default
```

> [!NOTE]
> *You can pass any valid color in `Hex` or `RGB` format*

![Custom TitleBar Color](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/titlebar_color.png)

### Set TitleBar Color to windows Accent Color

```python
title_bar_color.set_accent(window) # sets the titlebar color to the current windows accent color
```

![Accent TitleBar](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/accent_titlebar.png)

> [!NOTE]
> *The titlebar color will automatically change when the windows accent color changes*

## 🖌️ Custom TitleBar Text Color

```python
title_text_color.set(window, '#ff00ff') # sets the titlebar text color to magenta
# title_text_color.reset(window) # resets the titlebar text color to default
```

![Custom TitleBar Text Color](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/title_text_color.png)

## 🖌️ Custom Border Color

```python
border_color.set(window, '#ff00ff') # sets the border color to magenta
# border_color.reset(window) # resets the border color to default
```

![Custom Border Color](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/border_color.png)

### Set Border Color to windows Accent Color

```python
border_color.set_accent(window) # sets the border color to the current windows accent color
```

![Accent Border](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/accent_border.png)

> [!NOTE]
> *The border color will automatically change when the windows accent color changes*

## 💻 Window Management

### Center a window on the screen

```python
window_frame.center(window)
```

### Center a secondary window relative to the primary window

```python
window_frame.center_relative(window, child_window)
```

![Center Relative](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/center_relative.png)

**Example Usecase**

```python
window = CTk()
window.title("Primary Window")
window.geometry('600x300')
window_frame.center(window)

child_window = CTkToplevel()

window_frame.center_relative(window, child_window)

window.bind("<Configure>", lambda event: window_frame.center_relative(window, child_window))

def on_close():  # this is required to stop the window from centering the child window after the parent window is closed
	window.unbind("<Configure>")
	child_window.destroy()

child_window.protocol("WM_DELETE_WINDOW", on_close)

window.mainloop()
```

![Center Relative Example](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/center_relative_example.gif)

### Other basic window management functions

```python
window_frame.move(window, 100, 100) # moves the window to (100, 100)
window_frame.resize(window, 500, 500) # resizes the window to 500x500
window_frame.maximize(window) # maximizes the window
window_frame.minimize(window) # minimizes the window
window_frame.restore(window) # restores the window
```

## ✨ Window Animations

### Circle Motion

```python
window_animation.circle_motion(window, count=5, interval=5, radius=30)
# moves the window in a circular motion 5 times with 5ms interval and 30px radius
```

![Circle Motion](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/circle_motion.gif)

*The animation might appear a bit fasterer and rougher in the above preview gif than it is*

### Verical Shake

```python
window_animation.vertical_shake(window, count=5, interval=5, amplitude=20)
# shakes the window vertically 5 times with 5ms interval and 10px distance
```

### Horizontal Shake

```python
window_animation.horizontal_shake(window, count=5, interval=5, amplitude=20)
# shakes the window horizontally 5 times with 5ms interval and 10px distance
```

## ✏️ Stylize text

```python
title_text.stylize(window, style=1)
```

*Below is a gif demonstrating all of the available styles*

![Stylize Text](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/stylize_text.gif)

## Miscellaneous

## Get Windows Accent Color

```python
print(get_accent_color()) # prints the current windows accent color
>>> '#1b595a'
```

## Stylize text

```python
print(stylize_text("Your Custom Text", style=1)) # stylizes your text
# all of the styles shown on the above gif are available
>>> "𝔜𝔬𝔲𝔯 ℭ𝔲𝔰𝔱𝔬𝔪 𝔗𝔢𝔵𝔱"
```

## Workaround for other libraries

This menthod is applicable for any other UI library like <kbd>pygame</kbd> <kbd>pySimpleGUI</kbd>, etc. which are not mentioned in the [supported libraries list](#-supported-libraries). You just need to pass the `hwnd` of the window to the functions as demonstrated below.

```python
from hPyT import *
import ctypes

hwnd = ctypes.windll.user32.GetActiveWindow()
rainbow_border.start(hwnd)
```

<br>

## 📜 hPyT Changelog

### v1.3.5

- Add feature for automatically changing the accent color of the titlebar and border
- Fix an issue which caused ImportError when used with a python version less than 3.9

### v1.3.4

- Add method for applying the current windows accent color to the titlebar and border color
- Add method for getting the current windows accent color
- Add type annotations and docstrings to functions for better clarity and autocompletion

### v1.3.3

- Fixed taskbar unhide/hide bug

### v1.3.2

- Add support for synchronizing the rainbow effect with other ui elements.

### v1.3.1

- Add support for UI libraries like Kivy, PySimpleGUI, PyGame, etc.
- Improve the rainbow titlebar & border effects.
- Improve the center_relative function & examples.

### v1.3.0

- Add support for setting custom border color
- Add support for rainbow border color effect
- Add support for resetting the titleBar color and titleText color
- Fix an issue which caused the titleBar to appear black after the rainbow titleBar effect was stopped

### v1.2.1

- Minor Bug Fixes

### v1.2.0

- Add support for rainbow titlebar
- Add support for styling title text
- Add support for vertical, horizontal shake and circle motion window animations
- Add support for centering a window on the screen
- Add support for centering a window relative to another window
- Add support for moving/resizing/maximizing/minimizing/restoring a window
- Add support for setting custom titlebar color
- Add support for setting custom titlebar text color

### v1.1.3

- Add flashing inverval support

### v1.1.2

- Add window flashing support
- Add window opacity support
- Add support for PyGTK

### v1.1.1

- Add support for WxPython, PyQt and PySide

### v1.1.0

- Initial Release

<br>

![PyPI](https://img.shields.io/pypi/v/hPyT?style=flat-square)
![Python](https://img.shields.io/badge/python-3.6+-blue)
![Downloads](https://img.shields.io/pypi/dm/hPyT?style=flat-square)
![Stars](https://img.shields.io/github/stars/zingzy/hPyT?style=flat-square)
![Contributors](https://img.shields.io/github/contributors/zingzy/hPyT?style=flat-square)
![Last Commit](https://img.shields.io/github/last-commit/zingzy/hPyT?style=flat-square)

---

<h6 align="center">
© zingzy . 2024

All Rights Reserved</h6>

<p align="center">
	<a href="https://github.com/zingzy/hPyT/blob/master/LICENSE"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=363a4f&colorB=b7bdf8"/></a>
</p>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zingzy/hPyT",
    "name": "hPyT",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "Tkinter wxpython pyqt pyside GUI window controls decorations hide show titlebar border color animation",
    "author": "zingzy",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/ca/24/715eb4e1773e09f2ce8a25bf464ed4b6c8e1db8dcdaf8871e46acdee0c22/hpyt-1.3.5.tar.gz",
    "platform": null,
    "description": "# hPyT - Hack Python Titlebar\n\nA package to manipulate windows and titlebar of GUI applications made using python\n**Supports Both Windows 11 and 10**\n\nhttps://github.com/Zingzy/hPyT/assets/90309290/f86df1c7-b75b-4477-974a-eb34cc117df3\n\n**You can download the above app from the [github releases](https://github.com/Zingzy/hPyT/releases/tag/hPyT-preview/) to test out the package before installing/using it in your projects**\n\n<br>\n\n<details>\n\n<summary>\ud83d\udcd6 Table of Contents</summary>\n\n- [hPyT - Hack Python Titlebar](#hpyt---hack-python-titlebar)\n\t- [\ud83d\udcda Supported Libraries](#-supported-libraries)\n\t- [\ud83d\udce6 Installing](#-installing)\n\t- [\ud83d\udce5 Importing](#-importing)\n\t- [Hide/Unhide Title Bar](#hideunhide-title-bar)\n\t- [\ud83c\udf08 Rainbow TitleBar](#-rainbow-titlebar)\n\t- [\ud83c\udf08 Rainbow Border](#-rainbow-border)\n\t\t- [\ud83d\udd04 Synchronizing the Rainbow Effect with other elements](#-synchronizing-the-rainbow-effect-with-other-elements)\n\t- [Hide/Unhide both Maximize and Minimize Buttons (Completely Hides both buttons)](#hideunhide-both-maximize-and-minimize-buttons-completely-hides-both-buttons)\n\t- [Hide/Unhide All Buttons or Stuffs](#hideunhide-all-buttons-or-stuffs)\n\t- [Enable/Disable Maximize Button](#enabledisable-maximize-button)\n\t- [Enable/Disable Minimize Button](#enabledisable-minimize-button)\n\t- [Opacity](#opacity)\n\t- [\u26a1 Flashing Window](#-flashing-window)\n\t- [\ud83c\udfa8 Custom TitleBar Color](#-custom-titlebar-color)\n\t\t- [Set TitleBar Color to windows Accent Color](#set-titlebar-color-to-windows-accent-color)\n\t- [\ud83d\udd8c\ufe0f Custom TitleBar Text Color](#\ufe0f-custom-titlebar-text-color)\n\t- [\ud83d\udd8c\ufe0f Custom Border Color](#\ufe0f-custom-border-color)\n\t\t- [Set Border Color to windows Accent Color](#set-border-color-to-windows-accent-color)\n\t- [\ud83d\udcbb Window Management](#-window-management)\n\t\t- [Center a window on the screen](#center-a-window-on-the-screen)\n\t\t- [Center a secondary window relative to the primary window](#center-a-secondary-window-relative-to-the-primary-window)\n\t\t- [Other basic window management functions](#other-basic-window-management-functions)\n\t- [\u2728 Window Animations](#-window-animations)\n\t\t- [Circle Motion](#circle-motion)\n\t\t- [Verical Shake](#verical-shake)\n\t\t- [Horizontal Shake](#horizontal-shake)\n\t- [\u270f\ufe0f Stylize text](#\ufe0f-stylize-text)\n\t- [Miscellaneous](#miscellaneous)\n\t- [Get Windows Accent Color](#get-windows-accent-color)\n\t- [Stylize text](#stylize-text)\n\t- [Workaround for other libraries](#workaround-for-other-libraries)\n\t- [\ud83d\udcdc hPyT Changelog](#-hpyt-changelog)\n\t\t- [v1.3.5](#v135)\n\t\t- [v1.3.4](#v134)\n\t\t- [v1.3.3](#v133)\n\t\t- [v1.3.2](#v132)\n\t\t- [v1.3.1](#v131)\n\t\t- [v1.3.0](#v130)\n\t\t- [v1.2.1](#v121)\n\t\t- [v1.2.0](#v120)\n\t\t- [v1.1.3](#v113)\n\t\t- [v1.1.2](#v112)\n\t\t- [v1.1.1](#v111)\n\t\t- [v1.1.0](#v110)\n</details>\n\n---\n\n## \ud83d\udcda Supported Libraries\n\n- Tkinter & CustomTkinter\n- PyQt\n- PySide\n- WxPython\n- Kivy\n- And many more\n\n## \ud83d\udce6 Installing\n\n```powershell\npip install hPyT==1.3.5\n```\n\n## \ud83d\udce5 Importing\n\n```python\nfrom hPyT import *\nfrom customtkinter import * # you can use any other library from the above mentioned list\n\nwindow = CTk() # creating a window using CustomTkinter\n```\n\n## Hide/Unhide Title Bar\n\n```python\ntitle_bar.hide(window) # hides full titlebar\n# title_bar.unhide(window)\n```\n\n![image](https://github.com/littlewhitecloud/hPyT/assets/71159641/03e533fe-c42a-4d84-b138-176a73ad7977)\n\n## \ud83c\udf08 Rainbow TitleBar\n\n```python\nrainbow_title_bar.start(window, interval=5) # starts the rainbow titlebar\n# rainbow_title_bar.stop(window) # stops the rainbow titlebar\n```\n\n> [!NOTE]\n> *`interval` is the time in milliseconds in which the color would change*\n\n![Rainbow TitleBar](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/rainbow_titlebar.gif)\n\n## \ud83c\udf08 Rainbow Border\n\n```python\nrainbow_border.start(window, interval=4) # starts the rainbow border\n# rainbow_border.stop(window) # stops the rainbow border\n```\n\n![Rainbow Border](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/rainbow_border.gif)\n\n### \ud83d\udd04 Synchronizing the Rainbow Effect with other elements\n\n```python\nfrom hPyT import *\n\n...\n\nrainbow_title_bar.start(window, interval=30) # starts the rainbow titlebar\n# rainbow_border.start(window, interval=30) # also works with rainbow border\n\ncurrent_color = rainbow_title_bar.get_current_color() # or rainbow_border.get_current_color()\n# you can use this color to synchronize the color of other elements with the titlebar\n```\n\n![synchronization example](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/synchronization-example.gif)\n\n\n**Code for the above illustration available in [`/examples/rainbow-synchronization-example.py`](https://github.com/Zingzy/hPyT/blob/main/examples/rainbow-synchronization-example.py)**\n\n\n## Hide/Unhide both Maximize and Minimize Buttons (Completely Hides both buttons)\n\n```python\nmaximize_minimize_button.hide(window) # hides both maximize and minimize button\n# maximize_minimize_button.unhide(window)\n```\n\n![Hidden Maximize and Minimize Buttons](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/maximize_minimize.png)\n\n## Hide/Unhide All Buttons or Stuffs\n\n```python\nall_stuffs.hide(window) # hides close button\n# all_stuffs.unhide(window)\n```\n\n![Hide Everything](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/all_stuffs.png)\n\n_**Tip:** to hide the text set the window title to `''`_\n\n## Enable/Disable Maximize Button\n\n```python\nmaximize_button.disable(window) # hides maximize button\n# MaximizeButton.enable(window)\n```\n\n![Disabled Maximize Button](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/maximize.png)\n\n## Enable/Disable Minimize Button\n\n```python\nminimize_button.disable(window) # hides minimize button\n# MinimizeButton.enable(window)\n```\n\n![Disabled Minimize Button](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/minimize.png)\n\n## Opacity\n\n```python\nopacity.set(window, 0.5) # sets the window opacity to 50%\n# opacity.set(window, 1) # resets the window opacity to 100%\n```\n\n![Opacity 0.5 preview](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/opacity.png)\n\n## \u26a1 Flashing Window\n\n```python\nwindow_flash.flash(window, 10, 100) # flashes the window 10 times with 100ms interval\n# window_flash.stop(window) # stops the flashing immediately\n```\n\n*Flashing Interval starts from 10ms, **default 1000ms***\n\n![Flashing Window](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/flashing.gif)\n\n## \ud83c\udfa8 Custom TitleBar Color\n\n```python\ntitle_bar_color.set(window, '#ff00ff') # sets the titlebar color to magenta\n# title_bar_color.reset(window) # resets the titlebar color to default\n```\n\n> [!NOTE]\n> *You can pass any valid color in `Hex` or `RGB` format*\n\n![Custom TitleBar Color](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/titlebar_color.png)\n\n### Set TitleBar Color to windows Accent Color\n\n```python\ntitle_bar_color.set_accent(window) # sets the titlebar color to the current windows accent color\n```\n\n![Accent TitleBar](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/accent_titlebar.png)\n\n> [!NOTE]\n> *The titlebar color will automatically change when the windows accent color changes*\n\n## \ud83d\udd8c\ufe0f Custom TitleBar Text Color\n\n```python\ntitle_text_color.set(window, '#ff00ff') # sets the titlebar text color to magenta\n# title_text_color.reset(window) # resets the titlebar text color to default\n```\n\n![Custom TitleBar Text Color](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/title_text_color.png)\n\n## \ud83d\udd8c\ufe0f Custom Border Color\n\n```python\nborder_color.set(window, '#ff00ff') # sets the border color to magenta\n# border_color.reset(window) # resets the border color to default\n```\n\n![Custom Border Color](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/border_color.png)\n\n### Set Border Color to windows Accent Color\n\n```python\nborder_color.set_accent(window) # sets the border color to the current windows accent color\n```\n\n![Accent Border](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/accent_border.png)\n\n> [!NOTE]\n> *The border color will automatically change when the windows accent color changes*\n\n## \ud83d\udcbb Window Management\n\n### Center a window on the screen\n\n```python\nwindow_frame.center(window)\n```\n\n### Center a secondary window relative to the primary window\n\n```python\nwindow_frame.center_relative(window, child_window)\n```\n\n![Center Relative](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/center_relative.png)\n\n**Example Usecase**\n\n```python\nwindow = CTk()\nwindow.title(\"Primary Window\")\nwindow.geometry('600x300')\nwindow_frame.center(window)\n\nchild_window = CTkToplevel()\n\nwindow_frame.center_relative(window, child_window)\n\nwindow.bind(\"<Configure>\", lambda event: window_frame.center_relative(window, child_window))\n\ndef on_close():  # this is required to stop the window from centering the child window after the parent window is closed\n\twindow.unbind(\"<Configure>\")\n\tchild_window.destroy()\n\nchild_window.protocol(\"WM_DELETE_WINDOW\", on_close)\n\nwindow.mainloop()\n```\n\n![Center Relative Example](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/center_relative_example.gif)\n\n### Other basic window management functions\n\n```python\nwindow_frame.move(window, 100, 100) # moves the window to (100, 100)\nwindow_frame.resize(window, 500, 500) # resizes the window to 500x500\nwindow_frame.maximize(window) # maximizes the window\nwindow_frame.minimize(window) # minimizes the window\nwindow_frame.restore(window) # restores the window\n```\n\n## \u2728 Window Animations\n\n### Circle Motion\n\n```python\nwindow_animation.circle_motion(window, count=5, interval=5, radius=30)\n# moves the window in a circular motion 5 times with 5ms interval and 30px radius\n```\n\n![Circle Motion](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/circle_motion.gif)\n\n*The animation might appear a bit fasterer and rougher in the above preview gif than it is*\n\n### Verical Shake\n\n```python\nwindow_animation.vertical_shake(window, count=5, interval=5, amplitude=20)\n# shakes the window vertically 5 times with 5ms interval and 10px distance\n```\n\n### Horizontal Shake\n\n```python\nwindow_animation.horizontal_shake(window, count=5, interval=5, amplitude=20)\n# shakes the window horizontally 5 times with 5ms interval and 10px distance\n```\n\n## \u270f\ufe0f Stylize text\n\n```python\ntitle_text.stylize(window, style=1)\n```\n\n*Below is a gif demonstrating all of the available styles*\n\n![Stylize Text](https://raw.githubusercontent.com/zingzy/hPyT/main/assets/stylize_text.gif)\n\n## Miscellaneous\n\n## Get Windows Accent Color\n\n```python\nprint(get_accent_color()) # prints the current windows accent color\n>>> '#1b595a'\n```\n\n## Stylize text\n\n```python\nprint(stylize_text(\"Your Custom Text\", style=1)) # stylizes your text\n# all of the styles shown on the above gif are available\n>>> \"\ud835\udd1c\ud835\udd2c\ud835\udd32\ud835\udd2f \u212d\ud835\udd32\ud835\udd30\ud835\udd31\ud835\udd2c\ud835\udd2a \ud835\udd17\ud835\udd22\ud835\udd35\ud835\udd31\"\n```\n\n## Workaround for other libraries\n\nThis menthod is applicable for any other UI library like <kbd>pygame</kbd> <kbd>pySimpleGUI</kbd>, etc. which are not mentioned in the [supported libraries list](#-supported-libraries). You just need to pass the `hwnd` of the window to the functions as demonstrated below.\n\n```python\nfrom hPyT import *\nimport ctypes\n\nhwnd = ctypes.windll.user32.GetActiveWindow()\nrainbow_border.start(hwnd)\n```\n\n<br>\n\n## \ud83d\udcdc hPyT Changelog\n\n### v1.3.5\n\n- Add feature for automatically changing the accent color of the titlebar and border\n- Fix an issue which caused ImportError when used with a python version less than 3.9\n\n### v1.3.4\n\n- Add method for applying the current windows accent color to the titlebar and border color\n- Add method for getting the current windows accent color\n- Add type annotations and docstrings to functions for better clarity and autocompletion\n\n### v1.3.3\n\n- Fixed taskbar unhide/hide bug\n\n### v1.3.2\n\n- Add support for synchronizing the rainbow effect with other ui elements.\n\n### v1.3.1\n\n- Add support for UI libraries like Kivy, PySimpleGUI, PyGame, etc.\n- Improve the rainbow titlebar & border effects.\n- Improve the center_relative function & examples.\n\n### v1.3.0\n\n- Add support for setting custom border color\n- Add support for rainbow border color effect\n- Add support for resetting the titleBar color and titleText color\n- Fix an issue which caused the titleBar to appear black after the rainbow titleBar effect was stopped\n\n### v1.2.1\n\n- Minor Bug Fixes\n\n### v1.2.0\n\n- Add support for rainbow titlebar\n- Add support for styling title text\n- Add support for vertical, horizontal shake and circle motion window animations\n- Add support for centering a window on the screen\n- Add support for centering a window relative to another window\n- Add support for moving/resizing/maximizing/minimizing/restoring a window\n- Add support for setting custom titlebar color\n- Add support for setting custom titlebar text color\n\n### v1.1.3\n\n- Add flashing inverval support\n\n### v1.1.2\n\n- Add window flashing support\n- Add window opacity support\n- Add support for PyGTK\n\n### v1.1.1\n\n- Add support for WxPython, PyQt and PySide\n\n### v1.1.0\n\n- Initial Release\n\n<br>\n\n![PyPI](https://img.shields.io/pypi/v/hPyT?style=flat-square)\n![Python](https://img.shields.io/badge/python-3.6+-blue)\n![Downloads](https://img.shields.io/pypi/dm/hPyT?style=flat-square)\n![Stars](https://img.shields.io/github/stars/zingzy/hPyT?style=flat-square)\n![Contributors](https://img.shields.io/github/contributors/zingzy/hPyT?style=flat-square)\n![Last Commit](https://img.shields.io/github/last-commit/zingzy/hPyT?style=flat-square)\n\n---\n\n<h6 align=\"center\">\n\u00a9 zingzy . 2024\n\nAll Rights Reserved</h6>\n\n<p align=\"center\">\n\t<a href=\"https://github.com/zingzy/hPyT/blob/master/LICENSE\"><img src=\"https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=363a4f&colorB=b7bdf8\"/></a>\n</p>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Hack Python Titlebar - A package to manipulate windows and titlebar of GUI applications made using python.",
    "version": "1.3.5",
    "project_urls": {
        "Documentation": "https://github.com/zingzy/hPyT#readme",
        "Homepage": "https://github.com/zingzy/hPyT",
        "Source": "https://github.com/zingzy/hPyT",
        "Tracker": "https://github.com/zingzy/hPyT/issues"
    },
    "split_keywords": [
        "tkinter",
        "wxpython",
        "pyqt",
        "pyside",
        "gui",
        "window",
        "controls",
        "decorations",
        "hide",
        "show",
        "titlebar",
        "border",
        "color",
        "animation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "014f5e5ecda1b1f192c95d1dcd4ae312f38856fb43f5c2582c7c758a37c8b5d7",
                "md5": "8ee8d552a8b4e7da2e2fa59e66ec65fd",
                "sha256": "2dc3e542e923b0a16a0caabc7d2699fc34299161fa4f03b29cae1e9937b6ef6c"
            },
            "downloads": -1,
            "filename": "hPyT-1.3.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8ee8d552a8b4e7da2e2fa59e66ec65fd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 14500,
            "upload_time": "2024-11-28T00:19:50",
            "upload_time_iso_8601": "2024-11-28T00:19:50.971833Z",
            "url": "https://files.pythonhosted.org/packages/01/4f/5e5ecda1b1f192c95d1dcd4ae312f38856fb43f5c2582c7c758a37c8b5d7/hPyT-1.3.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ca24715eb4e1773e09f2ce8a25bf464ed4b6c8e1db8dcdaf8871e46acdee0c22",
                "md5": "fe5fe181375fe1cf36b315ce9accbd2d",
                "sha256": "3d32d677eb6746c81ffd00352478114e072c1156543477e6754548275eef0efb"
            },
            "downloads": -1,
            "filename": "hpyt-1.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "fe5fe181375fe1cf36b315ce9accbd2d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 18428,
            "upload_time": "2024-11-28T00:19:52",
            "upload_time_iso_8601": "2024-11-28T00:19:52.112703Z",
            "url": "https://files.pythonhosted.org/packages/ca/24/715eb4e1773e09f2ce8a25bf464ed4b6c8e1db8dcdaf8871e46acdee0c22/hpyt-1.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-28 00:19:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zingzy",
    "github_project": "hPyT",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "hpyt"
}
        
Elapsed time: 0.35777s