Compare commits

...

2 commits

Author SHA1 Message Date
Ruben van de Ven
fe351c7155 Doc update 2024-11-11 11:38:20 +01:00
Ruben van de Ven
e066ba7fea Explain custom points from which to transform 2024-11-11 11:37:42 +01:00
3 changed files with 8 additions and 5 deletions

View file

@ -42,9 +42,10 @@ corners = [
(window.width, window.height), # Top right
]
pins = PygletCornerPin(window, corners)
```
Moreover, you don't need to pin the window _corners_, but can pin from any four arbitrary points, by providing `source_points`.
Run [pattern.py](examples/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.

View file

@ -26,10 +26,9 @@ for i in range(y_steps+3):
def on_key_press(symbol, modifiers):
if symbol == pyglet.window.key.Q or symbol == pyglet.window.key.ESCAPE:
window.close()
exit()
pins = PygletCornerPin(window, corners=[[100,100],[800,100],[150,500], [300,300]], source_points=[[100,100], [700,100], [100,500], [300,300]])
pins = PygletCornerPin(window, source_points=[[100,100],[600,100],[100,300], [600,300]], corners= [[100, 100], [444, 155], [230, 250], [600, 300]])
# event handlers for dragging:
window.push_handlers(pins)
@ -42,4 +41,7 @@ def on_draw():
pins.draw()
pyglet.app.run()
pyglet.app.run()
print(f"point positions: {pins.pin_positions}")
print("Save these and pass them as 'corner' attribute to restore last position.")

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "pyglet-cornerpin"
version = "0.3.1"
version = "0.3.2"
description = "Add a corner pin transform to a pyglet window"
authors = ["Ruben van de Ven <git@rubenvandeven.com>"]
readme = "README.md"