Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building GUI applications with Python, GTK and Glade

Similar presentations


Presentation on theme: "Building GUI applications with Python, GTK and Glade"— Presentation transcript:

1 Building GUI applications with Python, GTK and Glade
Pete Savage Building GUI applications with Python, GTK and Glade Theme created by Sakari Koivunen and Henrik Omma Released under the LGPL license.

2 Roadmap Why use python? The Concepts The Tools Example Advanced
Resources Questions - Gulp!!

3 Why use Python? Easy to learn Promotes clean, readable code
Cross platform Linux/Windows Good RAD (Rapid Application Development) Great Documentation

4 The Concepts Signal “clicked” Handler Action to be performed

5 The Tools Python Ties everything together, handlers etc Glade
Designs the GUI Sets up signals with references PyGTK Interfaces between python and GTK GTK Library for drawing and handling graphical elements

6 Glade Easy to create complex GUI
Can handle linking of signals to handlers via a “dictionary” Can produce large-ish files

7 Glade Designer Toolbox Properties Project GUI Preview

8 Create an example An application that counts each time a button is clicked Presents a dialog box when the total button is clicked

9 What have we done? Created example.glade file Created main window
Set up initial widgets Tied widget signals to references

10 Python program Import glade Create GUI class
Assign signal references to handler functions Write handler functions

11 Extending the program Event handlers – act as an interrupt
e.g. “Are you sure you want to quit?”

12 The “delete_event” signal
User clicks the X button False Further handlers/methods allowed to run Handler returns True/False Class tries to delete widget program quits True Any further handlers/methods are ignored as event effectively deleted dialog box “Do you want to quit?” program continues “delete_event” signal is emitted Signal invokes handler on_delete_event

13 Advanced Topics Creating your own widgets Using Drag and Drop methods
Using treestores and liststores

14 Resources Python website http://www.python.org PyGTK website
Gnome website

15 Topics Covered Why use python? The Concepts The Tools Example Advanced
Resources Questions - Gulp!!

16 Questions? Questions?


Download ppt "Building GUI applications with Python, GTK and Glade"

Similar presentations


Ads by Google