如何在 Tkinter 中从全屏 canvas 中删除小边框
How to remove small border from fullscreen canvas in Tkinter
使用全屏时canvas,如以下代码:
from tkinter import *
root = Tk()
root.attributes("-fullscreen", True)
canvas = Canvas(root, background = "red") # I use a red background for visibility.
canvas.pack(fill = BOTH, expand = True)
我的整个屏幕周围有一个小边框(2 像素)。这发生在我测试代码的任何计算机上。
有什么方法可以删除此边框,例如让 canvas 填充整个屏幕直到最边缘?
Image of my full screen, with the fullscreen canvas
谢谢
将此选项设置为零:
canvas = Canvas(root, background="red", highlightthickness=0)
检查 documentation 找到完整的选项列表。它可以帮助您解决许多类似的问题。
使用全屏时canvas,如以下代码:
from tkinter import *
root = Tk()
root.attributes("-fullscreen", True)
canvas = Canvas(root, background = "red") # I use a red background for visibility.
canvas.pack(fill = BOTH, expand = True)
我的整个屏幕周围有一个小边框(2 像素)。这发生在我测试代码的任何计算机上。
有什么方法可以删除此边框,例如让 canvas 填充整个屏幕直到最边缘?
Image of my full screen, with the fullscreen canvas
谢谢
将此选项设置为零:
canvas = Canvas(root, background="red", highlightthickness=0)
检查 documentation 找到完整的选项列表。它可以帮助您解决许多类似的问题。