about polygon

S

Shi Mu

Why I got a black polygon in the following code?
How can I make it no-color filled?
Thanks!

import Tkinter

c = Tkinter.Canvas(width=220, height=220)
c.pack()
c.create_polygon(60,60,100,60,100,100,60,120)
c.mainloop()
 
P

Peter Otten

Shi said:
Why I got a black polygon in the following code?
How can I make it no-color filled?
Thanks!

import Tkinter

c = Tkinter.Canvas(width=220, height=220)
c.pack()
c.create_polygon(60,60,100,60,100,100,60,120)
c.mainloop()

You can set the color explicitly (use "" to denote transparency):

c.create_polygon(60,60,100,60,100,100,60,120, fill="", outline="black")

I don't know why that isn't the default.

Peter
 
J

Jan Voges

Hi!

Am Sun, 20 Nov 2005 03:55:21 -0800 schrieb Shi Mu:
Why I got a black polygon in the following code?
How can I make it no-color filled?

Use create_line instead:
c.create_line(60,60,100,60,100,100,60,120,60,60)

Jan
 
S

Shi Mu

Hi!

Am Sun, 20 Nov 2005 03:55:21 -0800 schrieb Shi Mu:


Use create_line instead:
c.create_line(60,60,100,60,100,100,60,120,60,60)

Jan
If so, what is the difference between create_line and create_polygon?
Thanks!
 
J

Jan Voges

Hi

Am Sun, 20 Nov 2005 04:45:52 -0800 schrieb Shi Mu:
If so, what is the difference between create_line and create_polygon?

create_polygon only creates closed polygons.

Jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top