On Tue, Dec 3, 2013, at 12:00, 杨有秀 wrote: > def loadConfig(self, id, config = None): > """ Load the config > """ > > platform = node.get_platform() > self.textLabel_Platform.setText(platform) > > > /home/20131203-Client/src/node.py > > def get_platform(self): > """ Returns node type > """ > > self.node.addCallback(self.get_model) > self.node.addCallback(self.success) > return self.model
addCallback is a method of twisted.internet.defer.Deferred, but I don't think your node is a Deferred. > def get_model(self, object): > model=object.callRemote("getModel") > return model This looks as though it will return a Deferred, from the callRemote. If that isn't the case, ignore everything else below. So you might write: def get_platform(self): """ Returns node type """ self.model = self.get_model() self.model.addCallback(self.success) return self.model def success(self, model): print '1111fff' return model And then you could use the value returned by get_platform (which is a Deferred) by adding a callback to it: def loadConfig(self, id, config = None): """ Load the config """ node.get_platform().addCallback(self.textLabel_Platform.setText) When the callRemote succeeds, it calls the callbacks on the Deferred. First, it passes the return value from the remote call to success(). Then it passes the return value from success() to textLabel_Platform.setText. Peter. _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python