GTK of {Linux} open-source Gui

Source: Internet
Author: User
Tags gtk

GTK + (gimp Toolkit) is a set of graphical toolkit for distribution by lgpl license protocol and cross-platform. Originally written for gimp, gimp has become a powerful and flexible universal graphics library. It is one of the mainstream development tools for developing graphic interfaces in GNU/Linux. GTK + also has Windows and Mac OS X versions. --- Baidu encyclopedia

Ubuntu uses GTK as the foundation for GNOME Desktop (gimp Toolkit)

In Linux, the graphical interface of Java is also known as GTK;

The wireshark packet capture tool also uses GTK as the interface development tool. It supports multiple operating systems, that is, cross platforms. You can download the source code for compilation and learning;

We recommend a development ide> codeblocks. It seems that this development tool is also open-source, but I have never downloaded its source code (and arm-Linux-GCC is also open-source, so you can download and modify it)

Appendix: Let's take a look at the Lua (script language) source code!

-------------- Routine 1 -------------------------------------

# Include <stdlib. h>
# Include <GTK/GTK. h>
Static void helloworld (gtkwidget * WID, gtkwidget * Win)
{
Gtkwidget * dialog = NULL;
Dialog = gtk_message_dialog_new (gtk_window (WIN), gtk_dialog_modal, gtk_message_info, gtk_buttons_close, "Hello world! ");
Gtk_window_set_position (gtk_window (DIALOG), gtk_win_pos_center );
Gtk_dialog_run (gtk_dialog (DIALOG ));
Gtk_widget_destroy (DIALOG );
}
Int main (INT argc, char * argv [])
{
Gtkwidget * button = NULL;
Gtkwidget * win = NULL;
Gtkwidget * vbox = NULL;
/* Initialize GTK + */
G_log_set_handler ("GTK", g_log_level_warning, (glogfunc) gtk_false, null );
Gtk_init (& argc, & argv );
G_log_set_handler ("GTK", g_log_level_warning, g_log_default_handler, null );
/* Create the main window */
Win = gtk_window_new (gtk_window_toplevel );
Gtk_container_set_border_width (gtk_container (WIN), 8 );
Gtk_window_set_title (gtk_window (WIN), "Hello World ");
Gtk_window_set_position (gtk_window (WIN), gtk_win_pos_center );
Gtk_widget_realize (WIN );
G_signal_connect (win, "Destroy", gtk_main_quit, null );
/* Create a vertical box with buttons */
Vbox = gtk_vbox_new (true, 6 );
Gtk_container_add (gtk_container (WIN), vbox );
Button = gtk_button_new_from_stock (gtk_stock_dialog_info );
G_signal_connect (g_object (button), "clicked", g_callback (helloworld), (gpointer) Win );
Gtk_box_pack_start (gtk_box (vbox), button, true, true, 0 );
Button = gtk_button_new_from_stock (gtk_stock_close );
G_signal_connect (button, "clicked", gtk_main_quit, null );
Gtk_box_pack_start (gtk_box (vbox), button, true, true, 0 );
/* Enter the main loop */
Gtk_widget_show_all (WIN );
Gtk_main ();
Return 0;
}

Bytes ----------------------------------------------------------------------------------------------------


Related Article

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.