nishantbhardwaj2002
nishantbhardwaj2002

Reputation: 767

How to use an image as a button in GTK?

How to use an image as a button in GTK in c language in code blocks? I have tried making the button of same color as that of the background and then adding image on it. But there is a outline or shadow still there. So, how can i remove those shadows or is there a way to directly use an image as a button?

Upvotes: 0

Views: 451

Answers (1)

user4815162342
user4815162342

Reputation: 154906

One way is outlined by @Shabhaz, by putting the image in an EventBox, and handling the button-press event.

The other way is by placing the image in the button and customizing the style of the button to remove the outline and the shadow. You would call gtk_rc_parse_string() to define an outline-less button class, and gtk_widget_set_name() on your button to apply the style.

Upvotes: 1

Related Questions