Advice on how to get started with 2D-plotting ?

rantingrick rantingrick at gmail.com
Tue Sep 6 16:59:41 EDT 2011


On Sep 6, 1:27 pm, Fred Pacquier <xne... at fredp.lautre.net> wrote:
> I'm a Python long-timer, but I've never had to use tools like Matplotlib &
> others before.
>
> Now, for my work, I would need to learn the basics fast, for a one-time
> quick-n-dirty job.

##################
## START SCRIPT ##
##################
#
# Easy_as.py
#
import Tkinter as tk
# Create a main window and a canvas.
app = tk.Tk()
can = tk.Canvas(
    app,
    width=500,
    height=500,
    #bd=1,
    #relief=tk.SOLID,
    )
can.pack(
    fill=tk.BOTH,
    expand=True,
    padx=5,
    pady=5,
    )
# Create some gridlines on the canvas.
W,H = 500, 500
row, col = 0,0
for _ in range(10):
    can.create_line(0, row, W, row, fill='red')
    print 0, row, W, row
    can.create_line(col, 0, col, H, fill='green')
    row += 50
    col += 50
can.create_line(
    0,500,300,300,
    350,200,400,450,
    fill='magenta',
    width=5,
    )
# Start the event loop.
app.mainloop()
################
## END SCRIPT ##
################

Any questions?



More information about the Python-list mailing list