Tkinter Transparent Background macOS


This Content is from Stack Overflow. Question asked by redhat

I’ve been messing around with different code snippets and combinations for a while now, trying to make it so my .gif file would have a transparent background. I’ve been successful in making the actual background transparent, but I find that my .gif goes transparent with it:

import tkinter as tk

root = tk.Tk()
root.wm_attributes("-topmost", True)
root.wm_attributes("-transparent", True)


root.image = tk.PhotoImage(file="sample.gif")
label = tk.Label(root, image=root.image)


I have found that whenever I use both root.config(bg='systemTransparent') and label.config(bg='systemTransparent'), the entire window and gif go transparent, but when I use just one or neither, I am left with a light-gray background.


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?