473,387 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Coordinates of curves with turtle module in python

How can i generate coordinates of curves using turtle module in python? I am a beginner in python.
Feb 7 '10 #1
2 11985
you can see "The 50+ demo applications of the turtle module of Python are intended as examples for using Python and turtlegraphics in an educational setting." on this page - http://code.google.com/p/python-turtle-demo/. It`s interesting :)
Feb 7 '10 #2
bvdet
2,851 Expert Mod 2GB
To generate the coordinates of a curve, you need an equation. Then you substitute values in the equation. Here's an example:
Expand|Select|Wrap|Line Numbers
  1. from time import sleep
  2. from turtle import *
  3.  
  4. def parabolaY(x, a=0.250, b=-10, c=0):
  5.     return a*x**2 + b*x + c
  6.  
  7. pen = Pen()
  8. pen.tracer(True)
  9. pen.color('red')
  10. pen.width(3)
  11. pen.goto(0,0)
  12. pen.down()
  13. for x in range(0,51):
  14.     pen.goto(x, parabolaY(x))
  15. pen.up()
  16. pen.goto(-100,-100)
  17. pen.color('green')
  18. pen.write("DONE!")
  19. sleep(2)
  20. pen._destroy()
Feb 7 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: dbrown2 | last post by:
I typically use IDLE for editing and debug. On Windows at least, IDLE and the standard turtle graphics module do not mix. I think both use Tkinter. For now I use IPython and Jedit when using...
4
by: Brent W. Hughes | last post by:
If the Turtle gets himself into a large (or infinite) loop, is there any way to stop him other than Ctrl-Alt-Del? Brent
1
by: Brent W. Hughes | last post by:
I'm using the turtle graphics module and am trying to teach it to my kids. The slowness of the turtle in drawing things is good at first because it's fun watching it do its thing. But now we'd...
19
by: Atif | last post by:
Hello all, In my html page I want to add an image say of 800x600. Now I want that when ever I am given two coordinates on this image say (x1, y1)=(50, 100) and (x2, y2)=(200, 300), the java script...
9
by: Warren Francis | last post by:
I'm fairly new to Python (2-3 months) and I'm trying to figure out a simple way to implement Bezier curves... So far I've tried the following: http://runten.tripod.com/NURBS/ ....which won't...
7
by: Dick Moores | last post by:
I accidentally stumbled across the Turtle Graphics module (turtle.py) the other day and have been having some fun with it. Now I'm wondering if there is a way to build into a script the saving...
5
by: tomy | last post by:
Hi All I am a newbie to turtle graphics in python, so sorry if you find this question too easy. How can I get smoother lines in turtle graphics? I am using python on windows. Thanks in advance
4
by: hello123 | last post by:
I saw this program from a website... Any solution ? Turtle Graphics: The Logo language, which is particularly popular among personal computer user, made the concept of turtle graphics famous. ...
1
by: Alexander.Oot | last post by:
I think the speed function may be broken from the turtle graphics package "from turtle import * speed('fastest') forward(50)"
1
by: Allen | last post by:
I'm using the turtle module in Python. Is there a way to save the turle state at any moment for recursive algorithms to easily return the turtle to an earlier point for another branch/etc? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.