Merry Christmas with php-gtk and object oriented software (tutorial).

drawing blinking stars with php-gtk It's time to have some fun for the holiday season. We are going to draw some stars in a Drawing Area. Stars will have random colors, and random blinking cycle. Will will try to write some object-oriented code to show good practices with php-gtk.

Grabbing a screenshot with Gdk

From Widget to Pixbuf

Need to grab a screenshot in your program? Or maybe you just need to create an image from an existing GtkWidget. There's an easy way to accomplish both tasks using GdkPixbuf::get_from_drawable();

To use the method you'll need two things - an empty GdkPixbuf and the "drawable" (GdkDrawable) associated with your widget. Most widgets will have a GdkWindow located in $widget->window. You can get the entire screen, however, by using Gdk::get_default_root_window();. Now for the code examples...

Extending GtkDrawingArea to draw animated graphs

Grapher class example Drawing graphs with GtkDrawingArea is very easy. This is even easier using Graph_Core.

Syndicate content