可以. 用fill='#XXXXXX'参数:
from Tkinter import Tk, Canvas, Frame, BOTH
from math import sin, pi,cos
def pentagramPoints(cx, cy, R):
xita = 36*pi/180
r = R*cos(2*xita)/cos(xita)
points = []
for i in range(0, 10):
angle = i*xita + 0.5*xita
if i % 2:
points+=[cx + r*cos(angle), cy - r*sin(angle)]
else:
points+=[cx + R*cos(angle), cy - R*sin(angle)]
return points
if __name__ == '__main__':
root = Tk()
f = Frame(root)
f.pack(fill=BOTH, expand=1)
canvas = Canvas(f)
canvas.create_polygon(30, 10, 160, 470, 290, 10, outline="#000000", fill="#00ff00", width=3)
canvas.create_polygon(pentagramPoints(480, 240, 100), outline = '#000000', fill='#ff0000', width=3)
canvas.pack(fill=BOTH, expand=1)
root.geometry("640x480+300+300")
root.mainloop()
去买一本《Python科学计算》吧,上面都有讲的。你要是很急,就上京东去买,第二天就送到你手里了。