Just drawing lines and plotting points?

Alf P. Steinbach alfps at start.no
Wed Jan 27 09:05:40 EST 2010


* rantingrick:
> On Jan 26, 10:52 pm, "Alf P. Steinbach" <al... at start.no> wrote:
>> * rantingrick:
>>
>>
>>
>>
>>
>>> On Jan 26, 9:38 pm, Terry Reedy <tjre... at udel.edu> wrote:
>>>> On 1/26/2010 7:54 PM, Chris Rebert wrote:
>>>>> On Tue, Jan 26, 2010 at 4:36 PM, Someone Something<fordhai... at gmail.com>  wrote:
>>>>>> Hello,
>>>>>> I need a python library that makes drawing lines and plotting points (these
>>>>>> two things are the only things I need to do) easy. Or, how can I do
>>>>>> something like this with pygame? Basically, what I want to do is make
>>>>>> graphs. In pygame, since the coordinate system switches the x's and the y's
>>>>>> I would have to switch them again when I plot my points so my graphs look
>>>>>> okay. I hope this was enough info for me to get a good answer.
>>>>> matplotlib, perhaps?:http://matplotlib.sourceforge.net/
>>>> or dislin?
>>> it doesn't get any easier than the tkCanvas widget...
>>> import Tkinter as tk
>>> #import tkinter as tk #python3.0+
>>> app = tk.Tk()
>>> canvas = tk.Canvas(app)
>>> canvas.pack()
>>> canvas.create_line(sx,sy, ex,ey)
>>> #...
>>> #...
>>> app.mainloop()
>> He he, it's even easier to draw a graph using the turtle module.
>>
>> Cheers,
>>
>> - Alf
> 
> Yes Alf please forgive me, i had completely forgotten about the
> "visual" learners amongst us.
> 
> turtle, turtle, watch him go...
> turtle, turtle, why he so slow...
> turtle, turtle, not even he don't know...?
> 
> ;-)

Uhm, that is a misconception.

Just do

   turtle.hideturtle()
   turtle.tracer( 0 )

to turn off the animation stuff.

That said, the turtle module bundled with Python is somewhat limited, but for 
plotting simple graphs it's certainly simpler than using tkinter directly.


Cheers & hth.,

- Alf



More information about the Python-list mailing list