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.2.0.tar.gz (3.4 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.2.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyglet_cornerpin-0.2.0.tar.gz
  • Upload date:
  • Size: 3.4 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.2.0.tar.gz
Algorithm Hash digest
SHA256 8fe8a7618c11f93ac3b3c8b89b71e4398bf1223eea9ac3ea744e9d36031a44f9
MD5 c4a60633f2617b273839d783b9d64da1
BLAKE2b-256 c5fbc95d8ab9e69a4ce22c17fe4540a062359746f1a859fe6f495d8d6d509fa5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyglet_cornerpin-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e1cf4f2e86929fb74e89939be8f7ebdb110f65bf0923e51466e8fbd44773dc5
MD5 655b9ba26c501562176766b7cfc57fec
BLAKE2b-256 c4fe8e4333ae6ca24539fab4048c5172826ca7847e264a714e9586afa00a243f

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