Answer a question

I wanted to create an app which has an image as its background. But when I add a Label over the image, the label had a white background.

Is there a way to set the Label widget's background color to 'transparent'?

Answers

I'm not aware of a way to make Label backgrounds transparent. One alternative is to use a Canvas widget as the base for the whole thing, then use the create_image method to add the background image, and create_text to make the text labels. It will be a bit more work, but the text should render without a background on top of the image. (Admittedly I have very little experience with the Canvas widget, so I'm speaking more from theory than experience, but it's worth a try.)

If you don't have a good Tkinter reference, I highly recommend this one made by New Mexico Tech. It's available as a downloadable PDF as well.

Logo

Python社区为您提供最前沿的新闻资讯和知识内容

更多推荐