Showing posts with label lines. Show all posts
Showing posts with label lines. Show all posts

Thursday, 28 January 2016

Canvas - Drawing Lines


The first code is a simple example:
from Tkinter import *
root = Tk()
c1 = Canvas(root, height = 180, width = 200)
c1.create_line(20, 20, 160, 160, fill = "orange"  , width = 3)
c1.create_line(40, 50, 100, 110, fill = "yellow"  , width = 3)
c1.pack()
root.title("Lines")
root.mainloop()
 
We must create a canvas using the "Canvas" method, also its dimensions are declared here.