Giter Site home page Giter Site logo

vn-os / win32mica_windows_mica_effect_in_python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marticliment/win32mica

0.0 0.0 0.0 178 KB

Win32mica: a simple module to add the Mica effect on legacy python windows.

Home Page: https://pypi.org/project/win32mica

License: MIT License

Python 100.00%

win32mica_windows_mica_effect_in_python's Introduction

Win32mica: A simple module to add the Mica effect on Python UI Windows

The aim of this project is to apply the Mica effect on python applications made with Python, like Tkinter, PyQt/PySide, WxPython, Kivy, etc.
This will work on any windows version, including the new released dev builds where the mica API is public.

View this project on PyPi View this project on GitHub

Installation:

python -m pip install win32mica

Requirements:

  • Windows 11
  • A window set to not have a transparent background and to have extended composition enabled* (It might work with other settings, but nothing is guaranteed.)
  • The HWND (identifier) of that window. More info: what is a hwnd?
  • OPTIONAL: The window must have semi-transparent widgets/controls in order to recreate the transparency effect on the controls.
  • OPTIONAL: Know if Windows has dark or light mode enabled. This can be checked with the darkdetect module

Usage:

#####################################################################
#                                                                   #
# Those examples are oversimplified, please see the examples folder #
# for detailed usage with each UI library.                          #
#                                                                   #
#####################################################################

hwnd = qtwindow.winId().__int__() # On a PyQt/PySide window
hwnd = tkwindow.frame() # On a tkinter window
# You'll need to adjust this to your program

from win32mica import MICAMODE, ApplyMica

mode = MICAMODE.DARK  # Dark mode mica effect
mode = MICAMODE.LIGHT # Light mode mica effect
# Choose one of them following your app color scheme

import darkdetect # You can pass the darkdetect return value directly, since the ColorMode accepts bool values (True -> dark, False -> light)
mode = darkdetect.isDark()

win32mica.ApplyMica(hwnd, mode)

You can check out the examples folder for detailed use in Tk and PySide/PyQt.

Result:

image
image

Those are PySide2 windows with custom widgets.

Troubleshooting:

For more information about possible errors/mistakes, make sure to add the following before using win32mica:

# Add these lines at the very start of your script
import win32mica
win32mica.debugging = True

win32mica_windows_mica_effect_in_python's People

Contributors

marticliment avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.