Ionut
Ionut

Reputation: 839

How to shade text color in TclTk

I implemented a button in TclTk with the text "Click". What I have to do is to write the text with different shades of green.

Is there anyway to make the text' color of a button to be green shaded?

Upvotes: 1

Views: 385

Answers (1)

Donal Fellows
Donal Fellows

Reputation: 137707

The Tk button makes all of its text be a single colour (controlled by the -foreground option) as that's by far the most important use case for the large majority of users. Making the text vary in colour across its face is outside this use case, and so requires substantial trickery. The two ways I can think of are to use an image instead of a text label (when you can draw whatever you want on it, using the alpha channel to let the background show through) or to use a canvas widget to simulate a button.

Making an image (PNG, or GIF in 8.5 and before) is quite a lot easier.

Upvotes: 1

Related Questions