Skip to main content

Add a corner pin transform to a pyglet window

Project description

Pyglet CornerPin

This is a little utility that adds corner pin transforms to a pyglet window.

Installation

pip install pyglet-cornerpin

Usage

Create instance for a window, and register the event handlers for dragging the pins. A on_key_release is also registered to handle keyboard controls to move the pins.

pins = PygletCornerPin(window)
# event handlers for dragging:
window.push_handlers(pins)

Then you can draw the pins in your on_draw() event.

@window.event
def on_draw():
    window.clear()
    ...
    # draw corner pins
    pins.draw()

Optionally you can provide initial positions for the pins.

corners = [
    (0, 0),                        # Bottom left
    (window.width),                # Bottom right
    (0, window.height),            # Top left
    (window.width, window.height), # Top right
]
pins = PygletCornerPin(window, corners)

Run pattern.py in the examples folder for a demo.

To use the keyboard, select a pin with number keys 1-4, the use the arrow keys (optionally with ctrl/shift modifier) to move the handle.

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

pyglet_cornerpin-0.3.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

pyglet_cornerpin-0.3.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file pyglet_cornerpin-0.3.1.tar.gz.

File metadata

  • Download URL: pyglet_cornerpin-0.3.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.11.5-amd64

File hashes

Hashes for pyglet_cornerpin-0.3.1.tar.gz
Algorithm Hash digest
SHA256 16fc7afecfe3e9bdc68f7d34c0f9984f5955750a5ea4dcb00714b0d0f6c7d707
MD5 d136913d4093154a9e4645fdefefafdd
BLAKE2b-256 e1e3a13d1bfac3a7c847cf1b4d1720f51c536f2c6b51c4a44a4c2b3dcfad9df9

See more details on using hashes here.

File details

Details for the file pyglet_cornerpin-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: pyglet_cornerpin-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.11.5-amd64

File hashes

Hashes for pyglet_cornerpin-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d4e7e9b25640ccb8410c2bcdad9cf7a74d42dbee710f3228b58808fde3adf74
MD5 16230d40bbcf09b6886ed4065f14b814
BLAKE2b-256 e15fb6c38f1897f441a781c0d1c13fd84283dac2af1b673384a46296704515d2

See more details on using hashes here.

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