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.0.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.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyglet_cornerpin-0.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 3df5578f2255209d6df84074ae2c3d5deb25d345466bcd52c8ab97d4f95ec903
MD5 dfa86f501e153014423979ac84d7fbf1
BLAKE2b-256 611588b8b670a745d44d3a6592fa5901a2e5870857d41be761b1759d7120131e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyglet_cornerpin-0.3.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64058a8c0bc1a8fc0369cdf41ec09f0d40e18d4c2b02fb74a1748fe82b2479c7
MD5 0b27b5cd1fc0a12d36fff1cdc17de254
BLAKE2b-256 2d83105c40aab54fad81d1d21073bdd5ab4be7377e6eb9df4dc624cf1a711561

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