Search code examples
pythontkinterbackgroundlabeltransparency

How can I turn a transparant background visible again in tkinter?


I'm using Python Tkinter my_label.master.wm_attributes("-transparentcolor", "white") to turn the backgorund of a new pop-up label transparent and my_label.master.wm_attributes("-transparentcolor", "grey") to make it visible again. This works because I have a white background with black letters on it. But this seems a little greedy to me. Is there a different way of turning the background visible again?


Solution

  • From tcl's documentation: If the empty string is specified (default), no transparent color is used.

    That means that you can use .attributes("-transparentcolor", "") to reset the transparent colour of the window.