Skip to main content

A Python wrapper for the Windows Direct2D and DirectWrite APIs

Project description

pyD2D - A Python wrapper for the Windows Direct2D API

pyD2D is a Python wrapper for the Windows Direct2D and DirectWrite APIs.

Note: Not all of the Direct2D and DirectWrite APIs are wrapped, but the most commonly used ones are. If you need a specific API that is not wrapped, feel free to open an issue or submit a pull request.

Note: This project may not have prebuilt wheels for your Python version. If you need a wheel that's missing, please open an issue.

Installation

pip install pyd2d

Usage

See the demo app for a working example app using pyD2D and ctypes.

Basic usage is as below:

import pyd2d

# Initialize COM
pyd2d.InitializeCOM()

# Create a Direct2D factory
factory = pyd2d.GetD2DFactory()

# Create a render target
render_target = factory.CreateHwndRenderTarget(
    my_hwnd, width=800, height=600,
)

# Draw a rectangle
render_target.BeginDraw()
render_target.Clear(1.0, 1.0, 1.0, 1.0)
render_target.FillRectangle(100, 100, 200, 200, render_target.CreateSolidColorBrush(0.0, 0.0, 0.0, 1.0))
render_target.EndDraw()

License

pyD2D is licensed under the MIT License.

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

pyd2d-0.1.3.tar.gz (15.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyd2d-0.1.3-cp314-cp314-win32.whl (83.3 kB view details)

Uploaded CPython 3.14Windows x86

pyd2d-0.1.3-cp313-cp313-win32.whl (81.2 kB view details)

Uploaded CPython 3.13Windows x86

pyd2d-0.1.3-cp312-cp312-win32.whl (85.2 kB view details)

Uploaded CPython 3.12Windows x86

File details

Details for the file pyd2d-0.1.3.tar.gz.

File metadata

  • Download URL: pyd2d-0.1.3.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyd2d-0.1.3.tar.gz
Algorithm Hash digest
SHA256 aed674fe3d63affd0e40de88f68649f4dc6583062191fbeaffc499942f19e633
MD5 cf871b3a2eaf6ddb2e87d4fff57b5edc
BLAKE2b-256 4d4dd4028820e5bec7a99daaf4573d1fb3e33267c7b4a64f98e684f87ee27eb9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyd2d-0.1.3.tar.gz:

Publisher: publish.yml on merlinz01/pyd2d

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyd2d-0.1.3-cp314-cp314-win32.whl.

File metadata

  • Download URL: pyd2d-0.1.3-cp314-cp314-win32.whl
  • Upload date:
  • Size: 83.3 kB
  • Tags: CPython 3.14, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyd2d-0.1.3-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 8b9551d836c7598ec310efdf74a0eac234563b7faff409f67132e1df46eb4baa
MD5 9673e63ec0f9f53c24b0ad5cb94799a3
BLAKE2b-256 8f56b4180c6bdeddde70a351089c9c5d7b771e865854d903cce2a8f9c8001e64

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyd2d-0.1.3-cp314-cp314-win32.whl:

Publisher: publish.yml on merlinz01/pyd2d

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyd2d-0.1.3-cp313-cp313-win32.whl.

File metadata

  • Download URL: pyd2d-0.1.3-cp313-cp313-win32.whl
  • Upload date:
  • Size: 81.2 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyd2d-0.1.3-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 04dc9b38fa7bb8eca69f9eaed9d1f1b1729231f0dc2a339e657a151186f1925b
MD5 ad6f2bf3f4ba57bba6b61d1b4541eedb
BLAKE2b-256 bb0780d4e6261bc89c28598e47889ba3664937336641d7d21545d65f60b18af6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyd2d-0.1.3-cp313-cp313-win32.whl:

Publisher: publish.yml on merlinz01/pyd2d

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyd2d-0.1.3-cp312-cp312-win32.whl.

File metadata

  • Download URL: pyd2d-0.1.3-cp312-cp312-win32.whl
  • Upload date:
  • Size: 85.2 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyd2d-0.1.3-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 57296e48047c8bfc26298350900b7719110c4e24d98f1fe9164cc3e72b48be73
MD5 b4c12c6e489ad80a6a30598d0ee316b6
BLAKE2b-256 ce9936e251409fb2ad997b4f930b2f49a130ec7e19f77e783d23bd413a98265a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyd2d-0.1.3-cp312-cp312-win32.whl:

Publisher: publish.yml on merlinz01/pyd2d

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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