Glade, PyGTK, gnome-python Textorial

a tutorial outlining the design of a small text editor and going over many gtk/glade/pygtk concepts

Overview

This tutorial attempts to explain simultaneously how to use each gtk, glade, and pygtk. Please keep in mind as you read this that this was mostly a trial by fire affair for me: I had little to no python experience (and no practical python experience) before this project with the exception of porting a previously available tutorial to GTK+2. If this sounds impressive, then this tutorial will probably help you.

Requirements

The packages needed for this tutorial are:

Foreward...

I am by no mean an expert, and that is by no mean an exhaustive list. Any dependencies that these libraries and programs have are obviously dependencies for this tutorial; I just chose to outline a few of the non-obvious (and a few of the obvious) packages that might not be installed on your machine.

slackware packages for the software are available at my website.

Finally, a few words about the tutorial itself, its structure, and perhaps what to expect (if you are trying to learn and exhaustively actually reading what I have to say, that is): I prefer tutorials, especially on topics of gui design and the usage of tools with guis, to have a good deal of screenshots. This means that I probably won't go more than 5 or 10 steps without a screenshot; and for dialup users this might present a bandwidth problem. Lastly, PyGTK, Python, Glade, etc. tutorials are few and far between, and those that are out there at the time of this writing are mostly outdated (with the exception of finlay's gtk tutorial). I will try my best to keep this tutorial up to date when new versions of software come out; but at my last estimate it might grow rather large. I am completely in favor of other people taking the tutorial and modifying it, especially when that leads to a more correct document.

most recent activity : Friday October 10

  1. Added "Glade and Events" section

Table of Contents

  1. Specifications
  2. Building the Main App
  3. Setting up Lib Glade Env in Python
    1. gtk.glade.XML()
    2. gnome.init()
  4. Signals and Events
    1. signal handlers
      1. signal_connect
      2. dictionaries
      3. signal_autoconnect
  5. Glade and Events/Signals
    1. destroy events
    2. delete events
    3. on clicked events
    4. activate events
  6. The First Signal handler
  7. Help/About Dialog
  8. PyGTK Library and Object Hierarchy
  9. Connecting the Help/About Dialog
  10. Pango Markup: Making the About Dialog
  11. Credits Dialog & Dialog recap
  12. gtk.TextView
    1. Properties of gtk.buffer
      1. buffer.get_line_count()
      2. buffer.get_char_count()
    2. Document Properties, Label pushing