Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
736 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 Reply

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...