2012-09-15 137 views
6

Tkinter.Canvas上繪製的線條不光滑。他們如何才能順利?爲什麼Tkinter帆布線鋸齒狀?

這裏是我的嘗試:

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() 

這裏是什麼樣子:

tkinter output from sample code

回答