Re: Gtk, Python, and Threading.



Hello,

2010/12/15, Robert Park <rbpark exolucere ca>:
> What am I missing here?
>
>     def request_geoname(self):
>         """Use the GeoNames.org webservice to name coordinates."""
>         if not self.valid_coords(): return
>         self.gfile = Gio.file_new_for_uri(
>             'http://ws.geonames.org/findNearbyPlaceNameJSON?lat=%s&lng=%s'
>             % (self.latitude, self.longitude))
>         self.gfile.read_async(0, None, self.receive_geoname, None)
>
>     def receive_geoname(self, gfile, result, alwaysnone):
>         """This callback method is executed when geoname download
> completes."""
>         print "Hello from the callback!", gfile, result, alwaysnone
>         print gfile.read_finish(result)

You want to use load_contents_async instead of the low-level APIs
which are a pain to use and probably not useful to you.

Attached is a simple script that demonstrates the use of load_contents_async.

HTH,
Abderrahim

Attachment: load_async.py
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]