Python v2.7
Windows 7

I am having some troubles drawing a line. I have called create_line inside a for loop, in which I gave it coordinates that are returned from another function. However, instead of drawing separate lines, it joins the lines together. Here is a snippet of my code:

from Tkinter import *

class App(object):
    def __init__(self, master):
        self.canvas = Canvas(width = 50, height = 30, bg = white)

    def create_lines(self):
        self.p = Plot
        for line in self.lines:
           for (x,y) in self.p.coord(line):
               self.canvas.create_line((x,y), fill = self.colour)
class Plot(Frame):

    def __init__(self, master):

        Frame.__init__(self, master)
       <Entry boxes, labels and buttons here>

    def coords(self, line):
        <a function here is used to generate coords based on line input>

How do I make it draw individual lines? Any help would be greatly appreciated. Thanks!

Re: Tkinter - create_line issue 80 80

Solved. My co-ordinates weren't outputting correctly

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.