Can I change the scrollregion on a Python turtle canvas? I want the drawing to move with it, not just the coordinates to shift. The appearance I'm going for is side-scroller like, where the screen's display region moves to center the turtle onscreen.
I've tried using turtle.setworldcoordinates(llx, lly, urx, ury)
, but, from the documentation, "This performs a screen.reset()
". I've also looked at this SO question , but this involves scroll bars, will not center the turtle easily, and has a limited canvas space. What I'm looking for is something that:
- Moves the display region to center the turtle
- Also moves the drawing
- Has an infinite scroll region
- does not display scroll bars
- can be called quickly with a function My best guess would be to be able to have an infinite scrolled canvas somehow, then hide the scroll bars and set them according to turtle position.
Is this possible in Python 2.7? I don't mind if it uses tkinter as well.
EDIT: 6-3-15
I found the canvas.xview
and canvas.yview
functions, but they don't seem to work once I define screen = turtle.TurtleScreen(canvas)
, and TurtleScreen has no xview
or yview
functions. I can't seem to make this work.
Then I found turtle.ScrolledCanvas()
. This seems ideal except it has no methods for setting scroll manually from the program. Can I set the scroll manually on a turtle.ScrolledCanvas()
???