oops...<br>I tried it but i got a bad segmentation fault!!<br>Is really a good threading implementation?<br><br><div><span class="gmail_quote">2006/2/2, Josiah Carlson <<a href="mailto:jcarlson@uci.edu">jcarlson@uci.edu
</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>My response is at the end.<br><br>Sbaush <<a href="mailto:sbaush@gmail.com">
sbaush@gmail.com</a>> wrote:<br>> Hi all.<br>> I've a problem with thread in python.<br>> My applications has a GUI that has some button.<br>> I've a MVC-like architecture.<br>> If i click on a button there is this effect:
<br>><br>> view.button_1_delete.Bind(EVT_BUTTON,self.OnDelete)<br>> view.button_1_list.Bind(EVT_BUTTON,self.OnList)<br>><br>> def OnDelete(self, evt):<br>>         self.presenter.updateModel("delete")
<br>> def OnList(self, evt):<br>>         self.presenter.updateModel("list")<br>><br>> Probably you image that the boss of this program is updateModel function.<br>> this function has this code:<br>
><br>> def updateModel(self,Type):<br>>         iptType=Type<br>>         self.readGUI(iptType)  # This function takes the request info from<br>> GUI<br>>         packet=self.ipt_writeXML(iptType) # Put info in XML string
<br>>         self.sender.send(packet) #Send the XML string<br>>         (xmlresponse,hostfrom)=self.receiver.receive() # Receive a XML<br>> string response from agent and the IP of agent<br>>         self.iptResponse.run
(xmlresponse,hostfrom) # view response in a<br>> separate view.<br>><br>> Now it works great, but there is a big problem: my app wait for response<br>> before allow user to do another request.<br>> I thought that with threads it could works perfectly.
<br>> I tried to apply threads but without any good result.<br>> Have you idea how can i do it and how can i apply thread to it?<br><br>import wx<br>import wx.lib.newevent<br>import threading<br><br>ResponseEvent, EVT_RESPONSE = 
wx.lib.newevent.NewEvent()<br><br>...<br>    def __init__(self, ...):<br>        ...<br>        self.Bind(EVT_RESPONSE, self.GotResponse, self)<br>        ...<br><br>    def _updateModel(self, Type):<br>        iptType=Type
<br>        self.readGUI(iptType)<br>        packet=self.ipt_writeXML(iptType)<br>        self.sender.send(packet)<br>        (xmlresponse,hostfrom)=self.receiver.receive()<br>        wx.PostEvent(self,<br>             ResponseEvent(xml=xmlresponse,
<br>                           host=hostfrom))<br><br>    def updateModel(self, Type):<br>        threading.Thread(target=self._updateModel,<br>                          args=(Type,)).start()<br><br>    def GotResponse(self, evt):
<br>        self.iptResponse.run(evt.xml, xml.host)<br>    ...<br><br><br> - Josiah<br><br></blockquote></div><br><br clear="all"><br>-- <br>Sbaush