Execute command and display it problem
Moved
Solved
Qt for Python
-
Dear all,
I made simple "MainWindow" by QT with "push-button" and "Text Browser".
Once I click on "push-button", execute a function which name is "Comm".
Everything is working fine except the output is not displaying in "Text Browser"
The Code
from PyQt5.QtWidgets import * from PyQt5.uic import * from os import path import sys import wmi FORM_CLASS,_ = loadUiType(path.join(path.dirname(__file__),"main2.ui")) class Ui_MainWindow(QMainWindow , FORM_CLASS): def __init__(self, parent=None): #super(Ui_MainWindow,self).__init_(parent) QMainWindow.__init__(self) self.setupUi(self) self.Size_UI() self.Buttons() def Size_UI(self): self.setWindowTitle('NetworkTools') self.setFixedSize(450,450) def Buttons(self): self.press.clicked.connect(self.Comm) def Comm(self): c = wmi.WMI () for s in c.Win32_NetworkAdapter(): if s.Manufacturer == "Intel" and s.Speed == "1000000000": print ("The PC is " +s.SystemName +" and the Speed is 1GB ") def main(): app = QApplication(sys.argv) window = Ui_MainWindow() window.show() app.exec_() if __name__ == '__main__': main()
The output
The PC is PCNAME and the Speed is 1GB
I need this "output" to display on "text browser"
Thanks in advance,
-
Hi
Something like
ui->textBrowser->setText("The PC is " +s.SystemName +" and the Speed is 1GB ");