Issue
I want to be able to completely blacken the screen on my Raspberry Pi, on the screen that doesn't have screen dimming as a separate feature. Or to nearly blacken it, drawing something very dimly. To this end, I am creating a full-screen tkinter
window and filling it with a canvas
, which I can draw black. Almost. I'm getting a one pixel white rim that remains. What is the best way to get rid of this rim, giving me a pure black background?
Here's my test code:
import tkinter as tk
_root = tk.Tk()
_root.withdraw()
def display(win):
win.create_oval(60,60,210,210,fill="green")
class GraphWin(tk.Canvas):
def __init__(self, title="Graphics Window"):
boss = tk.Toplevel(_root)
boss.attributes('-fullscreen', True)
tk.Canvas.__init__(self, boss, background = "black")
self.background = "black"
self.pack(fill = tk.BOTH, expand=True) # makes it fill the boss area
boss.lift()
_root.update()
window = GraphWin()
display(window)
_root.mainloop()
Here's my screenshot, although you'll probably have to download the image to see the white rim distinctively:
Solution
Used this highlightthickness=0
Change this:
tk.Canvas.__init__(self, boss, background = "black")
to:
tk.Canvas.__init__(self, boss, background = "black", highlightthickness=0)
Answered By - toyota Supra Answer Checked By - Terry (WPSolving Volunteer)