All Boards GTK Glade

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

All Boards GTK Glade

All Boards GTK Glade

GTK+ is a highly usable, feature rich toolkit for creating graphical user interfaces which boasts cross platform compatibility and an easy to use API. GTK+ it is written in C, but has bindings to many other popular programming languages such as C++, Python and C# among others. GTK+ is licensed under the GNU LGPL 2.1 allowing development of both free and proprietary software with GTK+ without any license fees or royalties. [Source: gtk.org]

As GTK+ is a graphical library, a program using GTK+ can be done in many languages like C, C++, Python, Perl, PHP, Ruby, and many others. Here a C example will be done.

How to make a simple program with GTK

An easier way to make a graphical interface (GUI) program using GTK+ is to use Glade as Graphical Editor.

400px-Glade34.png

Glade3 Screenshot

To install Glade on Ubuntu type:

$sudo apt-get install glade-3 

Old Glade versions used to generate C code. Currently version ONLY generates a .glade file that can be parsed in a .xml file which describes the hierachy of the widgets.

Let's create, compile and test a sample program on host and after, cross-compile for iMX platform and check it running on a PDK i.MX31 Development kit.

In order to develop on host PC, install libgtk2.0-dev typing:

$sudo apt-get install libgtk2.0-dev 
%3CLINGO-SUB%20id%3D%22lingo-sub-1111439%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EAll%20Boards%20GTK%20Glade%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1111439%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EGTK%2B%20is%20a%20highly%20usable%2C%20feature%20rich%20toolkit%20for%20creating%20graphical%20user%20interfaces%20which%20boasts%20cross%20platform%20compatibility%20and%20an%20easy%20to%20use%20API.%20GTK%2B%20it%20is%20written%20in%20C%2C%20but%20has%20bindings%20to%20many%20other%20popular%20programming%20languages%20such%20as%20C%2B%2B%2C%20Python%20and%20C%23%20among%20others.%20GTK%2B%20is%20licensed%20under%20the%20GNU%20LGPL%202.1%20allowing%20development%20of%20both%20free%20and%20proprietary%20software%20with%20GTK%2B%20without%20any%20license%20fees%20or%20royalties.%20%5BSource%3A%20gtk.org%5D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EAs%20GTK%2B%20is%20a%20graphical%20library%2C%20a%20program%20using%20GTK%2B%20can%20be%20done%20in%20many%20languages%20like%20C%2C%20C%2B%2B%2C%20Python%2C%20Perl%2C%20PHP%2C%20Ruby%2C%20and%20many%20others.%20Here%20a%20C%20example%20will%20be%20done.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CH3%20id%3D%22toc-hId-1082506811%22%20id%3D%22toc-hId-1082506811%22%20id%3D%22toc-hId-1998759828%22%3E%3CSPAN%20class%3D%22mw-headline%22%3EHow%20to%20make%20a%20simple%20program%20with%20GTK%20%3C%2FSPAN%3E%3C%2FH3%3E%3CP%3EAn%20easier%20way%20to%20make%20a%20graphical%20interface%20(GUI)%20program%20using%20GTK%2B%20is%20to%20use%20Glade%20as%20Graphical%20Editor.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22400px-Glade34.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22400px-Glade34.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F37772iB0A8AD38ADDF6410%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22400px-Glade34.png%22%20alt%3D%22400px-Glade34.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EGlade3%20Screenshot%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ETo%20install%20Glade%20on%20Ubuntu%20type%3A%3C%2FP%3E%3CPRE%20class%3D%22jive-pre%22%3E%24sudo%20apt-get%20install%20glade-3%20%3C%2FPRE%3E%3CP%3EOld%20Glade%20versions%20used%20to%20generate%20C%20code.%20Currently%20version%20ONLY%20generates%20a%20.glade%20file%20that%20can%20be%20parsed%20in%20a%20.xml%20file%20which%20describes%20the%20hierachy%20of%20the%20widgets.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ELet's%20create%2C%20compile%20and%20test%20a%20sample%20program%20on%20host%20and%20after%2C%20cross-compile%20for%20iMX%20platform%20and%20check%20it%20running%20on%20a%20PDK%20i.MX31%20Development%20kit.%3C%2FP%3E%3CP%3EIn%20order%20to%20develop%20on%20host%20PC%2C%20install%20libgtk2.0-dev%20typing%3A%3C%2FP%3E%3CPRE%20class%3D%22jive-pre%22%3E%24sudo%20apt-get%20install%20libgtk2.0-dev%20%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎09-10-2020 02:14 AM
Updated by: