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.

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.

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.1.0.tar.gz (3.0 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.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyglet_cornerpin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6a99dd79596e4a1f702351a0c3dd970c42c180b4d23d0b943b7d1578a83ac880
MD5 687502cd97779d05b5d897b2df553218
BLAKE2b-256 579e62497d1f9b7e659d8d4c2c68abbf4b6d7be14faddcaf05c673897fc5b3e1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyglet_cornerpin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de2dc3d510ef79ab88c365974ab6d5696ed107eac21774ede8ea1579d9036d1c
MD5 ef88b4731cc73c9e871add110c09bbc8
BLAKE2b-256 f1130e09054df5e6c95ae3cc09d587c0ecbd8defd916960233f21a2692a5d15e

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