Hi all.
I’ve a send/receive function that send a packet and wait for response.
i have a function like
self.sender.send(hostto,packet) #self.view.SetCursor(wx.StockCursor(wx.CURSOR_WAIT)) #self.view is a wx.Frame #Receive response from agent
(response,hostfrom)=self.receiver.receive(None)
As you can see i would that while i’m waiting for request i see the cursorWait.
I *think* I have got the commas and brackets right, but you may have to
experiment.
HTH
Frank Millman
···
From: Sbaush [mailto:sbaush@gmail.com]
Sent: 14 February 2006 03:06 AM
To: wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] cursor_wait waiting for a result
Hi all. I've a send/receive function that send a packet and wait for response. i have a function like
self.sender.send(hostto,packet) #self.view.SetCursor(wx.StockCursor(wx.CURSOR_WAIT)) #self.view is a
wx.Frame #Receive response from agent (response,hostfrom)=self.receiver.receive(None)
As you can see i would that while i'm waiting for request i see the cursorWait. Uncommenting my code that doesn't work
How can i do?
In my programs, that function work well. I don't know why your don't,
but I think that it's an "external" wx problem: are your
send(hostto,packet) function blocking? I think that can be the problem.
If yes, can you try to move it to a thread and see what's happen ?
Hi all.
I've a send/receive function that send a packet and wait for response.
i have a function like
self.sender.send(hostto,packet) #self.view.SetCursor(wx.StockCursor(wx.CURSOR_WAIT)) #self.view is a wx.Frame #Receive response from agent
(response,hostfrom)=self.receiver.receive(None)
As you can see i would that while i'm waiting for request i see the cursorWait.
Uncommenting my code that doesn't work
How can i do?
Depending on your platform the cursor may not actually change until control returns to the main loop and pending events are able to be processed. Since your code blocks on the receive call then the UI framework doesn't get a chance to update the cursor. One way to do this is to insert a call to wx.Yield after the SetCursor, but probably better would be to do your blocking functionality in another thread as others have suggested. See also:
Monday, February 13, 2006, 10:06:12 PM, Sbaush wrote:
Hi all.
I've a send/receive function that send a packet and wait for response.
i have a function like
self.sender.send(hostto,packet) #self.view.SetCursor(wx.StockCursor(wx.CURSOR_WAIT)) #self.view is a
wx.Frame #Receive response from agent
(response,hostfrom)=self.receiver.receive(None)
As you can see i would that while i'm waiting for request i see the
cursorWait.
Uncommenting my code that doesn't work
How can i do?
--
Sbaush
Have you tried this:
wx.BeginBusyCursor()
# Long running task
...
wx.EndBusyCursor()
-- tacao
No bits were harmed during the making of this e-mail.
Monday, February 13, 2006, 10:06:12 PM, Sbaush wrote:
Hi all.
I’ve a send/receive function that send a packet and wait for response.
i have a function like
self.sender.send(hostto,packet)
#self.view.SetCursor(wx.StockCursor(wx.CURSOR_WAIT)) #self.view is a
wx.Frame #Receive response from agent
(response,hostfrom)=self.receiver.receive(None)
As you can see i would that while i’m waiting for request i see the
cursorWait.
Uncommenting my code that doesn’t work
How can i do?
–
Sbaush
Have you tried this:
wx.BeginBusyCursor()
# Long running task
...
wx.EndBusyCursor()
– tacao
No bits were harmed during the making of this e-mail.