Freshly updated for GTK3, the 2nd edition of An Introduction to C & GUI Programming will teach you all you need to know to write simple programs in C and start creating GUIs, even if you’re an absolute beginner.
The first half of the book is an introduction to C, and covers the basics of writing simple command-line programs. The second half shows how to use the GTK user interface toolkit with C to create feature-rich GUI applications which can be run on the desktop.
- 156 pages of essential information:
- Create simple command-line C programs
- Control flow with conditions and loops
- Handle variables, strings, and files
- Design graphical user interface applications in C
- Handle user input with buttons and menus
- Use advanced UI features such as data stores and dialogs
Errata:
On page 79, there is a typo in the command used to build a GTK application; single hyphens have been used where double hyphens should have been used.
The line
`gcc gtktest.c `pkg-config -cflags -libs gtk+3.0` -o gtktest`
should be
`gcc gtktest.c `pkg-config --cflags --libs gtk+-3.0` -o gtktest`
In the preceding paragraph, the pkg-config instruction has the same error; the line
`pkg-config -cflags -libs gtk+3.0`
should be
`pkg-config --cflags --libs gtk+3.0`
Conditions of Use
This book is licensed under a Creative Commons License (CC BY-NC-SA). You can download the ebook An Introduction to C & GUI Programming, 2nd Edition for free.
- Title
- An Introduction to C & GUI Programming, 2nd Edition
- Publisher
- Raspberry Pi Press
- Author(s)
- Simon Long
- Published
- 2022-12-18
- Edition
- 2
- Format
- eBook (pdf, epub, mobi)
- Pages
- 156
- Language
- English
- ISBN-10
- 1912047454
- ISBN-13
- 9781912047451
- License
- CC BY-NC-SA
- Book Homepage
- Free eBook, Errata, Code, Solutions, etc.
Chapter 1: Getting started Learn how to use C to program the Raspberry Pi Chapter 2: Variables and arithmetic Create variables and do maths Chapter 3: Conditions and comparisons Control the flow of your C programs Chapter 4: More advanced flow control For loops and case statements Chapter 5: Pointers Variables have addresses too Chapter 6: Functions Split your code into bite-sized chunks Chapter 7: Arrays and strings Handle lists of values, and letters Chapter 8: The string library Simplify common operations on strings Chapter 9: User Input Reading and interpreting user input Chapter 10: File input and output Learn to read from and write to files Chapter 11: More about types and variables Type definitions, enumerations, and more Chapter 12: Header files and the preprocessor Splitting code up into multiple files Chapter 13: Introduction to GTK Get ready to start creating GUI elements Chapter 14: Your first GTK program Start coding in C with the GTK library Chapter 15: Buttons Make your window do something by adding a button Chapter 16: Labels and layout Use a box widget to add a text label to your window Chapter 17: More advanced layout Expand your window, and position and resize buttons automatically Chapter 18: User input Enable users to enter text and data, and to select options Chapter 19: Combo boxes and list stores Create combo boxes for user input and associate list stores with them Chapter 20: Tree views Use the GtkTreeView widget to display information Chapter 21: Menus Create menu bars with drop-down menus Chapter 22: Dialogs Give users information and ask them questions Chapter 23: Built-in dialogs GTK contains some ready-made dialogs Chapter 24: Customising widgets Change the properties of widgets Chapter 25: Glade Create window layouts for applications Chapter 26: Quick reference Cheat sheets and code examples