[Twisted-Python] question about twisted+wxPython : How to migrate to twistd ?

bino oetomo bino at indoakses-online.com
Mon Jan 9 20:14:45 EST 2012


Dear Glyph and All

I see a reply to my question via 
http://twistedmatrix.com/pipermail/twisted-python/2012-January/025076.html 
but I didn't receive it in my mail box (is there a problem with this list).

Thankyou for your reply.

Yes, I want it to run that script as .tac file.
Actualy I just need the wx part as "display" only. There is no "input" 
activity via WX.
My system will serve a driver. so the input part will use pushbuttons 
that will conected to USB via ArduinoBoard.
Thats why there is some previous post by me asking about combining 
serial with wokkel ... and I got Great enlightment from this list.

 From the script that combine wokkel and Arduino board .. I got knowlede 
on how to add more service to exixting twisted script using 
service.MultiService() and service.Application()

Basicaly I need to write a script that :
1. Display a base screen/panel/window when started
2. wait for command input via TCP/UDP/UnixSocket in JSON format
3. update the display based on variables inside incoming command

And if it not to much ... i prefer using twisted .tac file and 
service.MultiService() and service.Application().

Sincerely
-bino-


**On 01/09/2012 12:39 PM, bino oetomo wrote:
> Dear All ...
>
> I just copy and paste the code from 
> http://code.activestate.com/recipes/298985/
> and adding lines :
> --------------
>         self.allowNone = True
>         self.useDateTime = False
> --------------
> just before line#  45,
> and it work great.
>
> I need to adopting that script to my application, but I'm not familiar 
> with code line 64-78 :
> --------------------
> if __name__ == '__main__':
>
>     # Initiliaze MyApp
>     app = MyXMLRPCApp(False) # False -> printing stdout/stderr to shell,
>                              # not in an additional wx window
>
>     # Make wx application twisted aware
>     # Must have to start "wxreactor.install()" on top before
>     reactor.registerWxApp(app)
>
>     # Make a XML-RPC Server listening to port 7080
>     reactor.listenTCP(7080, server.Site(app))
> -------------------
>
> How to migrate that script to twistd, something like :
> ------------------
> #Create Application
> application = service.Application("MultiService Example")
> #Create xmlrpc site
> myrpc = MyRPC()
> site = server.Site(myrpc)
> myrpcservice = internet.TCPServer(50008, site, interface='localhost')
> #Creating Multi Service
> multiService = service.MultiService()
> #Add our Services to multiservice
> myrpcservice.setServiceParent(multiService)
> #Set created application to be serviceparent of multiservice
> multiService.setServiceParent(application)
> ------------------
>
> Kindly please give me your enlightment.
>
> Sincerely
> -bino-
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120110/dccf8fe4/attachment.htm 


More information about the Twisted-Python mailing list