[Tutor] Plotting

Gregor Lingl glingl@aon.at
Tue, 16 Jul 2002 08:40:44 +0200


----- Original Message -----
From: "Andrea Valle" <marta_andrea@libero.it>
To: <tutor@python.org>
Sent: Tuesday, July 16, 2002 2:37 AM
Subject: [Tutor] Plotting


> (Dear Sirs, sorry, it's me again).
> I'd like to plot dots and segments on a 2D plane.
> I have to do something like this pseudopseudocode:
> line.draw(xystart, xyend).

One way to accomplish this task is to use the standard
GUI toolkit of Python, Tkinter

example:

from Tkinter import *

lines = [10,20,40,10,65.77,111.5,215.33333, 28, 280,195]

root = Tk()                              # create Tk Window
cv = Canvas(root, width=300, height=200) # Canvas widget to do graphics
cv.pack()                                # call geometry manager

cv.create_line(lines)                    # this is - more or less -
                                         # what you want
mainloop()                               # starts event handling loop
# end of code


Ressources on Tkinter:

http://www.python.org/topics/tkinter/
http://mcl.ee.hallym.ac.kr/Menu/6_psd/python/tkinter

Regards
Gregor


> Suppose to have a logic representation in form a of a list of points and
to
> have to draw lines on a plane.
> Is it possible to do something like this in Python?
> If it's obvious (as I suspect), please point me to a link.
> Thank you as usual.
>
> best
>
>
> -a-
>
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>