看板 Python 關於我們 聯絡資訊
最近在剛學習使用python和pyqt 想請問一下如果使用下面的寫法 self.outputArea=QTextBrowser(self) def command1(self): for i in range(2,0,-1): self.telnet.write("cat /proc/version \r\n") time.sleep(2) content1 = self.telnet.read_very_eager().decode('big5','ignore') print content1 這樣telnet進入後,會在shell上每兩秒印出一次如下 /# cat /proc/version Linux version 3 但是如果想要印在QTextBrowser上的話,改成這樣的寫法 self.outputArea=QTextBrowser(self) def command1(self): for i in range(2,0,-1): self.telnet.write("cat /proc/version \r\n") time.sleep(2) content1 = self.telnet.read_very_eager().decode('big5','ignore') self.outputArea.append(self.trUtf8("%1").arg(content1)) 但是這樣顯示的時候就會 變成四秒後才會一次印出來兩次的內容 問題:想要每兩秒就顯示一次在QTextBrowser上面的話,卡關有點久, 想請教需要如何更改才是對的? 或是使用其他的寫法? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.249.109.19 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1506237111.A.BE9.html