PHP-GTK2 Newsletter
|
Sample Code 85: How to create a round button - Part 1? |
| Written by kksou | ||||||||
| Saturday, 04 November 2006 | ||||||||
|
Problem You want to create a round button as shown below:
Solution
Sample Code Note: The following image file is required by the sample code below. Please save a copy of the image file and put it in the same directory where you store the sample code.
Explanation You might be tempted to use GtkButton. Try it. You will see some lines by the edges. Think it's inherent for a button. That's why I ended up using GtkEventBox. Note that you can use any image format that is supported by php-gtk, as long as the image format supports transparent background (e.g. png, gif). The transparent background will be become the mask to produce the round button. Note
In this example, I try to simplify the codes so that it's easier to see the fundamentals for displaying a round button. In the next article, I will expand on this to show a more complete example - with button click state and rollover effect. Related Links
|
||||||||
| < Prev | Next > |
|---|





