Skip to content
pywinrtPublic

About

Python projection of Windows runtime (WinRT) types.

Resources

Contributing

Stars

204 stars

Watchers

4 watching

Forks

Latest commit

 

History

2,305 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

PyWinRT

winrt-runtime test docs

PyWinRT lets Python call Windows Runtime (WinRT) APIs: Bluetooth, USB and serial devices, cameras, notifications, screen capture, speech and many other APIs that Windows offers apps.

  • A projection: it is generated from the WinRT metadata, so every WinRT API in the Windows SDK is there, and the Windows App SDK's too.
  • Pythonic: snake_case names, collections that are sequences and mappings, async operations you await and any bytes-like object where WinRT takes a buffer, as the WinRT type system describes.
  • Fully typed: every package ships type hints, so editors complete your code and type checkers check it.

Installing

Each part of the WinRT API is a package of its own on PyPI. Install the ones your code uses, and each brings the runtime with it:

pip install winrt-Windows.Media.SpeechSynthesis

PyWinRT needs CPython 3.11 or later on Windows. Installing says which packages to choose.

Example

from winrt.windows.media.speechsynthesis import SpeechSynthesizer

for voice in SpeechSynthesizer.all_voices:
    print(voice.display_name, voice.language)

To hear the default voice, install uv and run the text-to-speech sample:

uv run --script https://raw.githubusercontent.com/pywinrt/pywinrt/refs/heads/main/samples/text_to_speech.py

The documentation covers the rest. You can also write WinUI 3 apps. The PyWinRT tool projects WinRT components of your own, and Versioning says how to package them.

More

About

Python projection of Windows runtime (WinRT) types.

Resources

Contributing

Stars

204 stars

Watchers

4 watching

Forks

Releases

Used by

Contributors

Languages