Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import os
  2. import sys
  3. from PyQt4.QtCore import *
  4. from PyQt4.QtGui import *
  5.  
  6. def main():
  7. app = QApplication(sys.argv)
  8. w = MyWindow()
  9. w.show()
  10. sys.exit(app.exec_())
  11.  
  12. class MyWindow(QWidget):
  13. def __init__(self, *args):
  14. QWidget.__init__(self, *args)
  15.  
  16. # create objects
  17. self.pb = QPushButton(self.tr("Run main script"))
  18. self.te = QTextEdit()
  19.  
  20. # layout
  21. layout = QVBoxLayout(self)
  22. layout.addWidget(self.pb)
  23. layout.addWidget(self.te)
  24. self.setLayout(layout)
  25.  
  26. # create connection
  27. self.connect(self.pb, SIGNAL("clicked(bool)"),
  28. self.run_command)
  29.  
  30. def run_command(self):
  31. stdouterr = os.popen4("./MyMainPythonScript.py")[1].read()
  32. self.te.setText(stdouterr)
  33.  
  34. if __name__ == "__main__":
  35. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement