GTK graphic interface programming in Linux-general Linux technology-Linux programming and kernel information. The following is a detailed description.
【Abstract]This article introduces the Xwindow graphic window programming tool GTK on the Linux platform, and provides the basic elements and steps for GTK programming.
【Key words]GTK, callback function, message processor, Regulator
GTK (GIMP Toolkit) is an interface tool for graphic user programming. It registration is completely free of charge, so it does not need to spend anything to develop free software or commercial software. Now many Linux integrated systems have packaged GTK1.2. Including RedHat Linux 6.0 and later versions, as well as Turbo Linux in Chinese culture. It is more and more widely used in UNIX system programming.
Another component is Glib, which contains some new extensions of standard applications to improve the compatibility of GTK. Some functions used in Linux systems may not be suitable for standard UNIX systems, such as g_strerror () functions. Some functions also extend the general functions of GNUC. For example, the g_malloc function has its own enhanced debugging functions.
GTK can be bound to multiple languages, including C ++, Guile, Perl, Python, Ton, Ada95, Objective C, Free Pascal, and Eiffel. Compile the software using a program developed in Standard C. You can use GNU with the GTK option. To develop Xwindow Graphics User Programs in other languages than standard C, you need to first refer to the content of the software binding (HTTP: // www.gtk.org ). If you use the C ++ language to call GTK for development, you can use the software GTK, which has been bound to C ++, to provide a better C ++ compiling environment than GTK.
The enhanced GTK + version of GTK has been developed. GTK + is a development kit that integrates GTK, GDK, and GLIB. It can work on many UNIX-like systems without GTK platform restrictions.
1. GTK Message Processing Mechanism
Let's take a look at a basic example. This example generates a window of 200x200 pixels. It can only use shell to kill a process (call the kill command ).