- Sample Codes
1.2 Display a button
|Written by kksou|
|Wednesday, 12 March 2008|
Let's use another widget in this example - a button.
In the previous example, we use GtkLabel to display "Hello World". In this example, we use GtkButton to display a button. The GtkLabel and GtkButton are called widgets in php-gtk. There are many other widgets in such as GtkRadioButton, GtkMenu, GtkTable, including GtkWindow.
For almost all php-gtk2 scripts, you will find the following four key lines (highlighted in blue):
Think of widgets as different types of Lego building blocks. Some are plain rectangular blocks. Some are round blocks. Some have buttons. By creatively combining these different building blocks, we can build almost anything we have in mind.
Same for php-gtk2. Writing php-gtk2 scripts is all about knowing what are the widgets available, and their corresponding properties, methods and signals.
|< Prev||Next >|