Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
767 views
in Technique[技术] by (71.8m points)

user interface - Python GUI toolkits that support text widget transparency or text widget with canvas background?

I am trying to write a program that displays a scrollable text widget over a striped background. The width of the stripes, the spacing between stripes, and the color of the stripes can be set by the user.

Here is a quick and dirty example of what I'm imagining:

Example

(It might seem like an ugly and pointless program, but it would be useful as a therapy tool for certain kinds of eye problems)

My original idea was to draw the stripes as rectangles on a canvas widget. Then I planned on overlaying the canvas with a text widget with a transparent background.

Right now, I am using Tkinter. But it appears that the text widget in Tkinter doesn't support transparency or using a canvas as a background. It appears that only a solid color can be used as a background.

What GUI toolkits are available for Python that would support the use of text widget background transparency / or a text widget that uses a canvas as a background?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Take a look at WXpython

here is an example of a transparent top-level window

Transparent Frames

WX is the only GUI library that i think could do this tkinter is good for more basic GUI's while WX is much more flexible

here are a few more examples of using transparency with WX

Transparent StaticText

Transparent Panel

I hope this helps you out!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...