Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top