python-3.x - 无法删除 1px 白色条带 - 即使添加了高光厚度?
问题描述
我遵循了这个例子,因为我在删除白色边框时遇到了问题。
OP 被告知要添加 highlightthickness 并将 x0、y0 和 y1 更改为 0。除了 1 px 的空白/行之外,这一切都有效吗?有任何想法吗?谢谢。
from tkinter import *
master = Tk()
master.configure(bg='#333333')
master.wm_attributes("-topmost", 1)
TopLevel.overrideredirect(True)
w = Canvas(master, width=150, height=40, bd=0, highlightthickness=0, relief='ridge',)
w.config()
w.pack(fill='both')
color = 100
x0 = 0
y0 = 0
x1 = 150
y1 = 0
while y0 < 20 :
r = color
g = color
b = color
rgb = r, g, b
Hex = '#%02x%02x%02x' % rgb
w.create_line(x0, y0, x1, y1,fill=str(Hex), width=1)
color = color - 2
y0 = y0 + 1
y1 = y1 + 1
color = 10
while y0 < 40 :
r = color
g = color
b = color
rgb = r, g, b
Hex = '#%02x%02x%02x' % rgb
w.create_line(x0, y0, x1, y1,fill=str(Hex), width=1)
color = color + 4
y0 = y0 + 1
y1 = y1 + 1
mainloop()
解决方案
我更改了 4. 和 7. 行,因为 PyCharm 给了我一个错误:
from tkinter import *
master = Tk()
tl = Toplevel() # delete me if the issue still remains :)
master.configure(bg='#333333')
master.wm_attributes("-topmost", 1)
tl.overrideredirect(True) # delete me if the issue still remains :)
...
如果问题仍然存在,请尝试删除 4. 和 7. 行。不应该有任何问题
推荐阅读
- perl - 如何在 UNIX 或 perl 中搜索和打印匹配的 wold?
- sql - 我想创建一个表,但机器人能够创建它
- visual-studio - 如何更改 Visual Studio 代码设置
- java - 如何使用 selenium 处理会话超时
- c# - MSSQL 从行之间指定的 2 个连接表中选择条目
- r - 添加 2 列并在 2 (R) 之后创建新列
- javascript - 在生产中使用 dotenv,还是将 env 变量传递给 js/js.erb?并尝试使用凭据
- kubernetes - kubeflow - jupyter pod 在某个时间产卵后卡住了
- oop - Android:存储库模式创建对象的最佳解决方案是什么?
- javascript - 如何在不刷新的情况下只更改表格的一列?