开发者

Continuously redraw wxPython element

开发者 https://www.devze.com 2022-12-11 22:28 出处:网络
I have a chat client that continuously polls a server and fetches new messages. From my def __init__() 开发者_如何学运维I have:

I have a chat client that continuously polls a server and fetches new messages.

From my def __init__() 开发者_如何学运维I have:

wx.CallAfter(self.pollServer)

Which is defined:

def pollServer(self):
    t = self.updateMessages()
    time.sleep(5)
    self.pollServer()

Now printing the messages into the Terminal shows that it works but the GUI is 'frozen' instead of being continuously refreshed and I thought CallAfter takes care of that. Could you help?


instead of

time.sleep(5)
self.pollServer()

try with

wx.CallLater(5,self.pollServer)
0

精彩评论

暂无评论...
验证码 换一张
取 消