Skip to main content

Hack Python Titlebar - A package to manipulate windows and titlebar of GUI applications made using python.

Project description

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/c61b3142-80d6-4c07-b8e3-65694faf945b

You can download the above app from the github releases to test out the package before installing/using it in your projects


📖 Table of Contents

📚 Supported Libraries

  • Tkinter & CustomTkinter
  • PyQt
  • PySide
  • WxPython
  • support for more libraries soon...

📦 Installing

pip install hPyT==1.2.0

📥 Importing

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

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

Hidden Title Bar

🌈 Rainbow TitleBar

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

interval is the time in milliseconds in which the color would change

Rainbow TitleBar

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

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

Hidden Maximize and Minimize Buttons

Hide/Unhide All Buttons or Stuffs

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

Hide Everything

Tip: to hide the text set the window title to ''

Enable/Disable Maximize Button

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

Disabled Maximize Button

Enable/Disable Minimize Button

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

Disabled Minimize Button

Opacity

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

⚡ Flashing Window

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

🎨 Custom TitleBar Color

title_bar_color.set(window, '#ff00ff') # sets the titlebar color to magenta

You can pass any valid color in Hex or RGB format

Custom TitleBar Color

🖌️ Custom TitleBar Text Color

title_text_color.set(window, '#ff00ff') # sets the titlebar text color to magenta

You can pass any valid color in Hex or RGB format

Custom TitleBar Text Color

💻 Window Management

Center a window on the screen

window_frame.center(window)

Center a secondary window relative to the primary window

window_frame.center_relative(window, child_window)

Center Relative

Example Usecase

window = CTk()
window.title("Primary Window")

child_window = CTkToplevel()

window_frame.center_relative(window, child_window)

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

Center Relative Example

Other basic window management functions

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

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

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

Verical Shake

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

Horizontal Shake

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

✏️ Stylize text

title_text.stylize(window, style=1)

Below is a gif demonstrating all of the available styles

Stylize Text

Miscellaneous

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

📜 hPyT Changelog

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

PyPI Downloads Contributions Welcome Last Commit


© zingzy . 2024

All Rights Reserved

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hPyT-1.2.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

hPyT-1.2.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file hPyT-1.2.0.tar.gz.

File metadata

  • Download URL: hPyT-1.2.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for hPyT-1.2.0.tar.gz
Algorithm Hash digest
SHA256 5854744e4570dc8bb8dc7c71f239ecc958c8583ae8b40de1778d6a11420b65a8
MD5 0eb551669c029483c9dec5fa40574965
BLAKE2b-256 e78b9ee2a7d00633884a05e8ba158e45a0e657a86ce74b2abcd4b28659fb79be

See more details on using hashes here.

File details

Details for the file hPyT-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: hPyT-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for hPyT-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 128b7c536cfc2ba7c5035ea18c6e0c64738664313b515e9e9f4a7b216ffaae79
MD5 ffa741e277ce2b102d932b252c1d3da8
BLAKE2b-256 928832d5823c52cd054888e05ad7f0b381f418ca84901d7aba8373edf001ffcd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page