[英]Remove automatic gap between gridded python Tkinter widgets
I'm using python2 on Windows.我在 Windows 上使用 python2。 When I run the followig code, I get a gap between the two canvas (see picture below), although there is no padding specified when I grid them.
当我运行 followig 代码时,我在两个画布之间得到了一个间隙(见下图),尽管我在网格它们时没有指定填充。 Is there any possibility to remove this?
有没有可能删除这个?
import Tkinter as tk
import ttk
class App(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
self.c1 = tk.Canvas(master=self, background='white', borderwidth=0,
relief=tk.FLAT)
self.c2 = tk.Canvas(master=self, background='white', borderwidth=0,
relief=tk.FLAT)
self.c1.grid(row=0, column=0, sticky=tk.NSEW)
self.c2.grid(row=1, column=0, sticky=tk.NSEW)
self.mainloop()
App()
Thanks for help!感谢帮助!
You need to set highlightthickness
to zero as well.您还需要将
highlightthickness
设置为零。
self.c1 = tk.Canvas(..., highlightthickness=0)
From the canvas page of effbot highlightthickness
explained as:从effbot
highlightthickness
的画布页面解释为:
The width of the highlight border.
高亮边框的宽度。 The default is system specific (usually one or two pixels).
默认值是系统特定的(通常是一两个像素)。 (highlightThickness/HighlightThickness)
(highlightThickness/HighlightThickness)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.