Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > about polygon

Reply
Thread Tools

about polygon

 
 
Shi Mu
Guest
Posts: n/a
 
      11-20-2005
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()
 
Reply With Quote
 
 
 
 
Peter Otten
Guest
Posts: n/a
 
      11-20-2005
Shi Mu wrote:

> 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

 
Reply With Quote
 
 
 
 
Jan Voges
Guest
Posts: n/a
 
      11-20-2005
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
 
Reply With Quote
 
Shi Mu
Guest
Posts: n/a
 
      11-20-2005
On 11/20/05, Jan Voges <(E-Mail Removed)> wrote:
> 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

If so, what is the difference between create_line and create_polygon?
Thanks!
 
Reply With Quote
 
Diez B. Roggisch
Guest
Posts: n/a
 
      11-20-2005
Shi Mu wrote:
> On 11/20/05, Jan Voges <(E-Mail Removed)> wrote:
>
>>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,6 0)
>>
>>Jan

>
> If so, what is the difference between create_line and create_polygon?


Well, that one is filled and the other not?

Diez
 
Reply With Quote
 
Jan Voges
Guest
Posts: n/a
 
      11-20-2005
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SVG polygon question Tripredacus-X XML 1 12-14-2004 01:11 PM
Polygon.contains() returns false?! VisionSet Java 8 04-28-2004 11:03 AM
How to enlarge a 2D polygon (conex, nonconvex) Shamli C Programming 4 10-11-2003 05:43 PM
Drawing a polygon using doubles Rick Java 3 10-08-2003 01:39 AM
layer and polygon Eveline Franken HTML 1 10-07-2003 06:09 AM



Advertisments