[問題] QTextBrowser and append 用法

作者: noshare (zzz...)   2017-09-24 15:11:49
最近在剛學習使用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上面的話,卡關有點久,
想請教需要如何更改才是對的? 或是使用其他的寫法?

Links booklink

Contact Us: admin [ a t ] ucptt.com