Kristjan
Kristjan

Reputation: 23

Modifying a Part of Text on tk.Button

I wonder if it is possible to change the weight of one word on a tkinter button? So the result would look something like this:

[ yes, I agree ]

I've tried using tags but neither tk.Button nor tk.Button['text'] seem to allow it.

Thanks!

Upvotes: 1

Views: 43

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385970

No, it's not possible. If you want a button with rich text you'll have to create your own. Or, create an image that has the look you want, and use the image with a standard button.

You can create your own using a text widget that is one character tall and a few characters wide. Then, you can place bindings on the button to handle clicks, and to change the relief to simulate a button. Unfortunately, it won't have the look of the platform-specific buttons.

Upvotes: 1

Related Questions