Python Forum

Full Version: How to animate a Turing Machine
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to depict a paper tape with ones and zeros scrolling past a read head "eye". I am little stuck on the design for this. I guess my first thought is to have a square object that can move left and right. One of these could look like a frame on a tape. That would mean drawing a square and writing a "0", etc.

An array of these could be made to move, by re-drawing (?) but I think it would get kinda choppy. Is there some other way to think about this. Is this a pygame Tkinter project? I would like some ideas on the best approach.

Also, would I be able to "draw" these frames off screen and then quickly run them past the read head. Maybe hundreds per second?
You can do this with tkinter, but it's not trivial, use a canvas
you can simulate fade-in: https://stackoverflow.com/questions/2744...-animation
I would think you could get good results by overlaying two images, and vary transparency on up, other down over a set
time period.
Proper animation is an art
do a google image search to find images with: "paper tape" encoding
here's some reading material: https://www.python-course.eu/turing_machine.php
also investigate tkinter lift and lower (can have multiple Frames ready)