about polygon

Discussion in 'Python' started by Shi Mu, Nov 20, 2005.

  1. Shi Mu

    Shi Mu Guest

    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()
    Shi Mu, Nov 20, 2005
    #1
    1. Advertising

  2. Shi Mu

    Peter Otten Guest

    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
    Peter Otten, Nov 20, 2005
    #2
    1. Advertising

  3. Shi Mu

    Jan Voges Guest

    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
    Jan Voges, Nov 20, 2005
    #3
  4. Shi Mu

    Shi Mu Guest

    On 11/20/05, Jan Voges <> 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!
    Shi Mu, Nov 20, 2005
    #4
  5. Shi Mu wrote:
    > On 11/20/05, Jan Voges <> 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?


    Well, that one is filled and the other not?

    Diez
    Diez B. Roggisch, Nov 20, 2005
    #5
  6. Shi Mu

    Jan Voges Guest

    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
    Jan Voges, Nov 20, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick
    Replies:
    3
    Views:
    1,063
    Chris Smith
    Oct 8, 2003
  2. VisionSet
    Replies:
    8
    Views:
    2,074
    VisionSet
    Apr 28, 2004
  3. Eveline Franken

    layer and polygon

    Eveline Franken, Oct 6, 2003, in forum: HTML
    Replies:
    1
    Views:
    368
  4. Tripredacus-X

    SVG polygon question

    Tripredacus-X, Dec 14, 2004, in forum: XML
    Replies:
    1
    Views:
    455
    Joris Gillis
    Dec 14, 2004
  5. Shamli
    Replies:
    4
    Views:
    998
    Rafal 'Raf256' Maj
    Oct 11, 2003
Loading...

Share This Page