Compare commits
No commits in common. "fe351c71558a093da4346ef61c3e21320bfaad27" and "e26ad868ec6eae6e7a0d9c4db33a69192debfa1c" have entirely different histories.
fe351c7155
...
e26ad868ec
3 changed files with 5 additions and 8 deletions
|
@ -42,9 +42,8 @@ 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.
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,10 @@ 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, source_points=[[100,100],[600,100],[100,300], [600,300]], corners= [[100, 100], [444, 155], [230, 250], [600, 300]])
|
pins = PygletCornerPin(window, corners=[[100,100],[800,100],[150,500], [300,300]], source_points=[[100,100], [700,100], [100,500], [300,300]])
|
||||||
# event handlers for dragging:
|
# event handlers for dragging:
|
||||||
window.push_handlers(pins)
|
window.push_handlers(pins)
|
||||||
|
|
||||||
|
@ -42,6 +43,3 @@ def on_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.2"
|
version = "0.3.1"
|
||||||
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