Reputation: 405
The lines drawn on a Tkinter.Canvas
are not smooth. How can they be made smooth?
Here's what I tried:
from Tkinter import *
root = Tk()
cv = Canvas(root,bg = 'white')
rt1 = cv.create_rectangle(10,10,110,110,width = 8,tags = ('r1','r2','r3'))
def printRect(event):
print 'rectangle'
def printLine(event):
print 'line'
cv.tag_bind('r1','<Button-1>',printRect)
cv.tag_bind('r1','<Button-3>',printLine)
cv.create_line(10,20,200,200,width = 5,tags = 'r1')
cv.pack()
root.mainloop()
Here's what it looks like:
Upvotes: 13
Views: 10384
Reputation: 123393
Tkinter
graphics are not anti-aliased which is why the diagonal line appears jagged. There may be a platform specific work-around like this one I found titled Drawing Anti-Aliased Graphics Under Tkinter/Windows to provide the functionality you desire.
Upvotes: 8
Reputation: 949
Upvotes: 1
Reputation: 1374
You might try to do some antialiasing of the poor, by drawing a clearer colored one pixel larger second line before (under) the first one.
Upvotes: 1