Skip to main content

Python wrapper for Windows Magnification API

Project description

WinMagnification

Windows PyPI version shields.io Documentation Status GitHub license

Python wrapper for Windows Magnification API

pip install WinMagnification

Covered functions:

  • MagInitialize
  • MagUninitialize
  • MagGetFullscreenColorEffect
  • MagSetFullscreenColorEffect
  • MagSetFullscreenTransform
  • MagGetFullscreenTransform
  • MagSetColorEffect
  • MagGetColorEffect
  • MagSetWindowTransform
  • MagGetWindowTransform
  • MagSetWindowSource
  • MagGetWindowSource
  • MagSetWindowFilterList
  • MagGetWindowFilterList
  • MagGetInputTransform
  • MagSetInputTransform
  • MagShowSystemCursor

You may use old-style function names:

import win_magnification as mag
import win_magnification.old as old_mag

old_mag.MagInitialize()
old_mag.MagSetFullscreenColorEffect(mag.const.COLOR_INVERSION_EFFECT)
old_mag.MagSetFullscreenColorEffect(mag.const.DEFAULT_COLOR_EFFECT)
old_mag.MagUninitialize()

Or you may use more pythonic function names:

import win_magnification as mag

mag.initialize()
mag.set_fullscreen_color_effect(mag.const.COLOR_INVERSION_EFFECT)
mag.reset_fullscreen_color_effect()
mag.finalize()

Or... you can even use Object-Oriented wrapper:

import win_magnification as mag

api = mag.WinMagnificationAPI()
api.fullscreen.color_effect.raw = mag.const.COLOR_INVERSION_EFFECT
api.fullscreen.color_effect.reset()

Restrictions

There are 3.5 groups of functions:

  • Fullscreen (nothing required, call and chill) have limited functional, but simple:
    • get/set_fullscreen_color_effect
    • get/set_fullscreen_transform
    • get_input_transform
  • Window (requires window creation as shown in example), more powerful, but requires such things like custom window creation (hello from pywin32), UiAccess (Hard to obtain) if you need your magnifier above everything, but you can simulate all fullscreen functions too:
    • get/set_color_effect
    • get/set_transform
    • get/set_source
    • get/set_filters (supports exclusion only, looks like excluded windows never exist for magnifier)
  • UiAccess required:
    • set_input_transform
  • Other:
    • initialize
    • finalize
    • set_cursor_visibility (cursor stay hidden until active)

Known alternatives

Pymagnification

I can't actually use this lib, I don't know why, it just does nothing and imports nothing. Also, it doesn't support fullscreen* functions

Known issues

Working from different threads is pain, and I'm trying to solve/restrict this somehow

PyWin32 Integration?

This package uses ctypes only, so no pywin32 required. But, well, you can use pywin32 for creating magnifier windows and so on (see example)

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

WinMagnification-0.1.0.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

WinMagnification-0.1.0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file WinMagnification-0.1.0.tar.gz.

File metadata

  • Download URL: WinMagnification-0.1.0.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for WinMagnification-0.1.0.tar.gz
Algorithm Hash digest
SHA256 05868a6c2400fc96755c139ff43f2b18ba499032f229380c8165f22abbc7426e
MD5 821e1baedf0a651fae1ca33ce2f55a62
BLAKE2b-256 2dd43ccd9255cc2e197eccda9b655dd9c48d5c367c7206b65cfab945f03e6027

See more details on using hashes here.

File details

Details for the file WinMagnification-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for WinMagnification-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 387d510eb4cdbadd7c70756969f2618c418982392ad36385d1e06ff1e34e0ce6
MD5 78f20c9f26076dc986b2110693aa25e9
BLAKE2b-256 63334e22e05e76af831a8a87d383fe6715eebcd0af03c6e559aa75eb2fe92115

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