SlideShare a Scribd company logo
Basic GTK+ & GUI Designing

     K. Karthikeyan
     CDAC, Chennai
Introduction
●   Linux Desktop Environments
      –   GNOME, KDE
      –   KDE's dependency on Qt drives towards GNOME


●   GIMP - GNU Image Manipulation Program
      –   Peter Mattis, Spencer Kimball, to replace motif
      –   GIMP Tool Kit(GTK)
      –   Object Oriented and renamed as GTK+
GTK+
Cross platform graphical tool kit, used by GNOME
applications.
Part of GNU project, LGPL
Written in 'C' and Language Bindings for
–   C++      gtkmm
–   Python   pygtk
–   PHP      php-gtk   etc.,
Latest stable version gtk+ 2.22.0
GTK+ and Supporting Libraries




 Glib – General Purpose utility library, Provides Cross platform interfaces,
 Abstract Data types
 Gobject – Provides Data types, signals, Object oriented Interfaces
 GDK – Graphics Library for X window system
 GdkPixbuf – provides functions for client side image manipulation
 Pango – Font and layout rendering
 ATK – Accessibility Tool Kit
GTK+ Widget Hierarchy


GtkObject


            GtkWidget


                        GtkContainer


                                       GtkBin


                                           GtkWindow
What we need..
●   GCC compiler
●   Editor
●   Gtk+ and its dependent packages
        –   libgtk2.0-dev, libgtk2.0-0, libglib2.0-dev, ...
●   Pkg-config package
●   How to check
    ●   $pkg-config - -cflags gtk+-2.0
    ●   $pkg-config - -libs gtk+-2.0
GTK+ hello world window
/*hello.c */
#include <gtk/gtk.h>
int main(int argc, char *argv[ ])
{
GtkWidget *window;
gtk_init (&argc, &argv); /* Initialization */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window),"Hello World");
gtk_widget_show(window);
gtk_main ();   /* Main Event loop */
return 0;
}
How to compile & Run “hello.c”
●   To Compile
      “gcc -Wall program.c -o executable_name `pkg-
      config --cflags --libs gtk+-2.0` “
      -Wall - Enable all types of compiler warnings
●   To Run
      ./executable_name
Hands on... :)
Signal Connection & Callback
                function
●   Connecting a signal with a function
    g_signal_connect(gpointer, “signal name”,
    callback_handler, gpointer);

●   Callback function format
    return_type callback_function(GtkWidget *, ...
    ,gpointer)
Basic Widgets and Initialization
●   Label     - gtk_label_new()
●   Buttons   - gtk_button_new() and more
●   Box       - gtk_hbox_new(), gtk_vbox_new()
●   Pane     - gtk_hpane_new(),
    gtk_vpane_new()
●   Table     - gtk_table_new()
●   Expander - gtk_expander_new() and more
●   Notebooks- gtk_note_book_new()
Basic Widgets and Initialization
●   Stock_Buttons
●   Toggle Button
       –   1. Toggle Button 2. Radio button 3. Check button
●   Text Entry
       –   1. Text Entry   2. Spin button
●   Scale
       –   1. Horizontal scale 2. Vertical scale
Some Important functions
●   GtkWidget
    ●   gtk_widget_set_size_request
    ●   gtk_widget_grab_focus
    ●   gtk_widget_set_sensitive
    ●   gtk_widget_destroy
●   GtkWindow
    ●   gtk_window_set_default_size
    ●   gtk_window_move
    ●   gtk_window_resizable
Resources & References
●   Books
    ●   Foundations of GTK+ Development – by Andrew Krause
    ●   The Offical GNOME 2 Developer's Guide -by Matthias Warkus
●   IRC Channels
    ●   Server --> irc.gnome.org
    ●   Channels
        –   #gtk+, #gnome-india, #gnome-love, #nosip ...
●   Websites
        library.gnome.org, en.wikipedia.org, ...
Thank You.... !

karthikeyank@cdacchn.in
karthikk5phy@gmail.com
 To Tweet : @karthik2u

More Related Content

What's hot (18)

ODP
Cross Platform Qt
Johan Thelin
 
PDF
Kernel Recipes 2016 - Control Group Status Update
Anne Nicolas
 
PDF
Javascript in linux desktop (ICOS ver.)
Yuren Ju
 
PDF
Building the QML Run-time
Johan Thelin
 
PDF
Qt Widget In-Depth
account inactive
 
PDF
How to Contribute to GStreamer
Samsung Open Source Group
 
PDF
Git: a tool for wizards
responseteam
 
PDF
BKK16-315 Graphics Stack Update
Linaro
 
PDF
Migrating from Photon to Qt
Janel Heilbrunn
 
ODP
Qt Creator, l'arma segreta!
QT-day
 
PDF
Red Hat Container Development Kit
Lalatendu Mohanty
 
PDF
Gcd(i os & os x 멀티스레딩 기법)
창욱 정
 
ODP
Debug JNI code with ndk-gdb and eclipse GUI
Tom Chen
 
PDF
Kubernetes on CRI-O
Suraj Deshmukh
 
PPTX
Notary - container signing
Moby Project
 
PDF
The Future of Qt Widgets
Marius Bugge Monsen
 
PPTX
Untitled presentation(4)
chan20kaur
 
PDF
2015 08-20-criu support-in_docker_for_native_checkpoint_and_restore
Saied Kazemi
 
Cross Platform Qt
Johan Thelin
 
Kernel Recipes 2016 - Control Group Status Update
Anne Nicolas
 
Javascript in linux desktop (ICOS ver.)
Yuren Ju
 
Building the QML Run-time
Johan Thelin
 
Qt Widget In-Depth
account inactive
 
How to Contribute to GStreamer
Samsung Open Source Group
 
Git: a tool for wizards
responseteam
 
BKK16-315 Graphics Stack Update
Linaro
 
Migrating from Photon to Qt
Janel Heilbrunn
 
Qt Creator, l'arma segreta!
QT-day
 
Red Hat Container Development Kit
Lalatendu Mohanty
 
Gcd(i os & os x 멀티스레딩 기법)
창욱 정
 
Debug JNI code with ndk-gdb and eclipse GUI
Tom Chen
 
Kubernetes on CRI-O
Suraj Deshmukh
 
Notary - container signing
Moby Project
 
The Future of Qt Widgets
Marius Bugge Monsen
 
Untitled presentation(4)
chan20kaur
 
2015 08-20-criu support-in_docker_for_native_checkpoint_and_restore
Saied Kazemi
 

Similar to Basics of gtk_ilugc (20)

PDF
An introduction to Gnome An introdu.pptx
JAYAVARSHINIJR
 
PDF
Gtk development-using-glade-3
caezsar
 
ODP
G T K+ 101
Ahmed Saeed
 
PDF
Pygtk tutorial
HarikaReddy115
 
PDF
gtk2-perl
tutorialsruby
 
PDF
gtk2-perl
tutorialsruby
 
PDF
نگاهی به Gtk3
Ali Vakilzade
 
PDF
SqueakGTK
ESUG
 
PPTX
Autotools pratical training
Thierry Gayet
 
PDF
GTK+ 2.0 App - Icon Chooser
William Lee
 
PDF
Qt Tutorial - Part 1
rmitc
 
PDF
Opensource Software usability
Giacomo Antonino Fazio
 
PDF
Making the GNOME 3.0 desktop accessible: building accessibility into GNOME Sh...
AEGIS-ACCESSIBLE Projects
 
PDF
Meiga Guadec 2009 English
eocanha
 
PDF
Embedded Linux - Building toolchain
Emertxe Information Technologies Pvt Ltd
 
PDF
Hildon 2.2: the Hildon toolkit for Fremantle
Alberto Garcia
 
PPTX
Php on the Web and Desktop
Elizabeth Smith
 
PPT
Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5
Amanda Lam
 
An introduction to Gnome An introdu.pptx
JAYAVARSHINIJR
 
Gtk development-using-glade-3
caezsar
 
G T K+ 101
Ahmed Saeed
 
Pygtk tutorial
HarikaReddy115
 
gtk2-perl
tutorialsruby
 
gtk2-perl
tutorialsruby
 
نگاهی به Gtk3
Ali Vakilzade
 
SqueakGTK
ESUG
 
Autotools pratical training
Thierry Gayet
 
GTK+ 2.0 App - Icon Chooser
William Lee
 
Qt Tutorial - Part 1
rmitc
 
Opensource Software usability
Giacomo Antonino Fazio
 
Making the GNOME 3.0 desktop accessible: building accessibility into GNOME Sh...
AEGIS-ACCESSIBLE Projects
 
Meiga Guadec 2009 English
eocanha
 
Embedded Linux - Building toolchain
Emertxe Information Technologies Pvt Ltd
 
Hildon 2.2: the Hildon toolkit for Fremantle
Alberto Garcia
 
Php on the Web and Desktop
Elizabeth Smith
 
Introduction to Application Development in Python and Gtk+ / Hildon @ Maemo 5
Amanda Lam
 
Ad

Recently uploaded (20)

PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PDF
July Patch Tuesday
Ivanti
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
July Patch Tuesday
Ivanti
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Ad

Basics of gtk_ilugc

  • 1. Basic GTK+ & GUI Designing K. Karthikeyan CDAC, Chennai
  • 2. Introduction ● Linux Desktop Environments – GNOME, KDE – KDE's dependency on Qt drives towards GNOME ● GIMP - GNU Image Manipulation Program – Peter Mattis, Spencer Kimball, to replace motif – GIMP Tool Kit(GTK) – Object Oriented and renamed as GTK+
  • 3. GTK+ Cross platform graphical tool kit, used by GNOME applications. Part of GNU project, LGPL Written in 'C' and Language Bindings for – C++ gtkmm – Python pygtk – PHP php-gtk etc., Latest stable version gtk+ 2.22.0
  • 4. GTK+ and Supporting Libraries Glib – General Purpose utility library, Provides Cross platform interfaces, Abstract Data types Gobject – Provides Data types, signals, Object oriented Interfaces GDK – Graphics Library for X window system GdkPixbuf – provides functions for client side image manipulation Pango – Font and layout rendering ATK – Accessibility Tool Kit
  • 5. GTK+ Widget Hierarchy GtkObject GtkWidget GtkContainer GtkBin GtkWindow
  • 6. What we need.. ● GCC compiler ● Editor ● Gtk+ and its dependent packages – libgtk2.0-dev, libgtk2.0-0, libglib2.0-dev, ... ● Pkg-config package ● How to check ● $pkg-config - -cflags gtk+-2.0 ● $pkg-config - -libs gtk+-2.0
  • 7. GTK+ hello world window /*hello.c */ #include <gtk/gtk.h> int main(int argc, char *argv[ ]) { GtkWidget *window; gtk_init (&argc, &argv); /* Initialization */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window),"Hello World"); gtk_widget_show(window); gtk_main (); /* Main Event loop */ return 0; }
  • 8. How to compile & Run “hello.c” ● To Compile “gcc -Wall program.c -o executable_name `pkg- config --cflags --libs gtk+-2.0` “ -Wall - Enable all types of compiler warnings ● To Run ./executable_name
  • 10. Signal Connection & Callback function ● Connecting a signal with a function g_signal_connect(gpointer, “signal name”, callback_handler, gpointer); ● Callback function format return_type callback_function(GtkWidget *, ... ,gpointer)
  • 11. Basic Widgets and Initialization ● Label - gtk_label_new() ● Buttons - gtk_button_new() and more ● Box - gtk_hbox_new(), gtk_vbox_new() ● Pane - gtk_hpane_new(), gtk_vpane_new() ● Table - gtk_table_new() ● Expander - gtk_expander_new() and more ● Notebooks- gtk_note_book_new()
  • 12. Basic Widgets and Initialization ● Stock_Buttons ● Toggle Button – 1. Toggle Button 2. Radio button 3. Check button ● Text Entry – 1. Text Entry 2. Spin button ● Scale – 1. Horizontal scale 2. Vertical scale
  • 13. Some Important functions ● GtkWidget ● gtk_widget_set_size_request ● gtk_widget_grab_focus ● gtk_widget_set_sensitive ● gtk_widget_destroy ● GtkWindow ● gtk_window_set_default_size ● gtk_window_move ● gtk_window_resizable
  • 14. Resources & References ● Books ● Foundations of GTK+ Development – by Andrew Krause ● The Offical GNOME 2 Developer's Guide -by Matthias Warkus ● IRC Channels ● Server --> irc.gnome.org ● Channels – #gtk+, #gnome-india, #gnome-love, #nosip ... ● Websites library.gnome.org, en.wikipedia.org, ...