Python Forum

Full Version: making dot move in a sinusoidal way
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi folks,

I am trying to move a dot side-to-side in Python, using the following equation: x_coordinates = 0 + (amplitude * sin(frequency*current time*2pi)). Does anyone have any ideas on how I might go about achieving this? I have searched for hours and I'm not even sure how to phrase the question succinctly enough for Google to comprehend!
How do you want to display your sinusoidal output? Turtle graphics? Multiple print statements to the console? Something else?
(May-03-2020, 03:28 AM)deanhystad Wrote: [ -> ]How do you want to display your sinusoidal output? Turtle graphics? Multiple print statements to the console? Something else?

Thanks for the reply! I would like to display it as an object, whereby the x axis position at each frame is determined by the output of the equation above.
How do you want to display the output? Your program will need to draw something. TO do this it needs to use a package that supports graphics. There are a lot of graphics packages in python.