Compare commits
2 commits
e26ad868ec
...
fe351c7155
Author | SHA1 | Date | |
---|---|---|---|
|
fe351c7155 | ||
|
e066ba7fea |
3 changed files with 8 additions and 5 deletions
|
@ -42,9 +42,10 @@ corners = [
|
||||||
(window.width, window.height), # Top right
|
(window.width, window.height), # Top right
|
||||||
]
|
]
|
||||||
pins = PygletCornerPin(window, corners)
|
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.
|
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.
|
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.
|
||||||
|
|
|
@ -26,10 +26,9 @@ for i in range(y_steps+3):
|
||||||
def on_key_press(symbol, modifiers):
|
def on_key_press(symbol, modifiers):
|
||||||
if symbol == pyglet.window.key.Q or symbol == pyglet.window.key.ESCAPE:
|
if symbol == pyglet.window.key.Q or symbol == pyglet.window.key.ESCAPE:
|
||||||
window.close()
|
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:
|
# event handlers for dragging:
|
||||||
window.push_handlers(pins)
|
window.push_handlers(pins)
|
||||||
|
|
||||||
|
@ -42,4 +41,7 @@ def on_draw():
|
||||||
pins.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.")
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "pyglet-cornerpin"
|
name = "pyglet-cornerpin"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
description = "Add a corner pin transform to a pyglet window"
|
description = "Add a corner pin transform to a pyglet window"
|
||||||
authors = ["Ruben van de Ven <git@rubenvandeven.com>"]
|
authors = ["Ruben van de Ven <git@rubenvandeven.com>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
Loading…
Reference in a new issue