diff --git a/README.md b/README.md index d30d5f0..1fa8a8a 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/examples/pattern.py b/examples/pattern.py index 24fa4a1..2dd8bfd 100644 --- a/examples/pattern.py +++ b/examples/pattern.py @@ -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() \ No newline at end of file +pyglet.app.run() + +print(f"point positions: {pins.pin_positions}") +print("Save these and pass them as 'corner' attribute to restore last position.") \ No newline at end of file