[Linux] GTK + graphic application development learning notes (1)-Overview

Source: Internet
Author: User

 GTK + graphical Application Development Learning notes (1)-Overview

 

1. What is gnome,

Gnome refers to "GNU network object model environment" (GNU network Object Model Environment), which is an exciting software development result in the Linux World. Although it has a long name, the purpose of this software project is very simple, that is, to achieve an always friendly and powerful user and Development desktop environment, this environment is completely based on free open-source software.


As its name suggests, gnome is both a desktop and a complete programming environment. Gnome is a program design interface between the underlying X Window System and the High-Level Manager software. It provides rich functions and powerful development tools to Gui programmers, these tools are lacking in Linux in the traditional sense.

 

2. What is gimp, GTK +

The basic toolkit in GNOME is GTK + (gimp Toolkit), which was originally written to simplify the development of gimp.

Gimp is an image processing program on UNIX operating systems. Gimp is short for general image processing programs or GNU Image Processing programs. Its function is similar to Photoshop in windows.

GTK + is a high-performance, object-oriented, cross-platform development kit that does not rely on specific languages. Before gnome appeared, GTK + was used to develop a large number of software programs. GTK + supports many programming languages, including C, C ++, Tom, Perl, Python, Guile, and Ada.

 

Iii. library used by GTK +

GTK + use the glib library and gdk (gimp drawing
Kit, gimp drawing Toolkit) series of development libraries, glib defines data types, provides error processing and memory management functions; while gdk is a transition layer between the local graphical API and GTK +. It depends on a specific computer platform. Therefore, to transplant GTK + to other computer platforms, you only need to rewrite gdk.

 

Iv. Installation of GTK +


Generally, the latest RedHat is fully installed with the GTK + tool library. You can directly develop programs on the top. If the current system does not have a GTK + tool library, you canWww.gtk.org. Download the source code for installation. The specific installation method is acceptable. See GTK + ON Cu
The post installed in 2.0 is not described here.


The method to test the system GTK + 2.0 is:

$ PKG-config -- modversion GTK ++-2.0

5. Use GTK + toolset to compile programs


The following is a simple program written using the GTK + Library. The purpose is to let everyone experience the fun of GTK + programming.

/* Base. C */

# Include <GTK/GTK. h>

Int main (INT argc, char * argv [])

{

Gtkwidget * window;

Gtk_init (& argc, & argv );

Window = gtk_window_new (gtk_window_toplevel );

Gtk_widget_show (window );

Gtk_main ();

Return false;

}


Compile it as follows:

$ Gcc-o base. c 'pkg-config -- cflags -- libs GTK +-2.0'

Note that the two items next to PKG-config -- cflags -- libs GTK +-2.0 are not single quotes. They are the symbols on the left of the number key 1. Everyone must pay attention to it. If you use single quotes, the compiler will prompt you PKG-config
-- Cflags -- libs GTK +-2.0 does not have that file or directory.

Run the following command:

$./Base

After the program runs, a base form is displayed.


You can feel that the GTK + program is no different from the common C language program, but it only calls the GTK + tool library.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.