| PyGTK Tutorial | ||
|---|---|---|
| <<< Previous | Chapter 18. Timeouts, IO and Idle Functions | Next >>> |
tag = input_add(source, condition, callback) |
Where the first argument (source) is the open file (Python file object ot lower level file descriptor integer) you wish to have watched. The input_add() method uses the lower level file descriptor integer internally but the function will extract it from the Python file object using the fileno() method as needed. The second (condition) specifies what you want GDK to look for. This may be one of:
INPUT_WRITE - Call your callback when the file is ready for writing.
INPUT_EXCEPTION - Call your callback when an exception was raised on the file.
The return value is a tag
that may be used to stop the monitoring of the file by using the following
function:
input_remove(tag) |
The callback function should be similar
to:
def input_callback(source, condition): |
Where source and condition are as specified above. The source value will be the lower level file descriptor integer and not the Python file object (i.e. the value that is returned from the Python file method fileno()).
| <<< Previous | Home | Next >>> |
| Timeouts, IO and Idle Functions | Up | Idle Functions |