去掉Tkinter中椭圆形的轮廓?

时间:2016-06-02 04:16:22

标签: python tkinter

默认情况下,我在画布上绘制的圆圈为黑色轮廓。我试图不使用颜色,但不知何故使轮廓消失。

import tkinter

class Draw:
    def __init__(self):
        self._root_window = tkinter.Tk()
        self._canvas = tkinter.Canvas(master = self._root_window,
                                  width = 500, height = 500,
                                  background = '#1E824C')
        self._canvas.pack()
        self._canvas.create_oval(100,100,250,250, fill = 'white')
        self._root_window.mainloop

if __name__ == '__main__':
    Draw()

enter image description here

2 个答案:

答案 0 :(得分:5)

outline=""参数添加到create_oval方法。

然后你可以创建椭圆链接:

self._canvas.create_oval(100,100,250,250, fill = 'white', outline="")

答案 1 :(得分:2)

除了使用outline =""outline = "white"之外,您还可以将大纲的宽度指定为0,因为默认情况下它设置为1

创建椭圆时,添加 width = 0 作为选项:

   self._canvas.create_oval(100,100,250,250, fill = 'white', width=0)

演示

enter image description here