1

So, I am trying to make a video game in Tkinter (no, I don't want to use PyGame), but I have ran into a bit of a problem.

I have realized that sometimes you may want to have two widgets overlap (e.g. sprite on top of background) but have the contents of both widgets to be visible. For example, I might have a sprite with transparent sections.

How do I set the "background" option of a widget so that there is no visible background?

Note: "you can't do this" answers are acceptable.

1 Answers1

1

This is not really posible in Tkinter. But you can set the transparency of the whole window with root.attributes('-alpha', 0.5)

For windows, you can do root.attributes("-transparentcolor", "red"), but again it will be applied to the whole window, not just the single widget.

DYD
  • 382
  • 2
  • 15
  • [This](https://stackoverflow.com/questions/5324647/how-to-merge-a-transparent-png-image-with-another-image-using-pil) may somewhat help though. – DYD Mar 18 '20 at 01:58