fork download
  1. print("");
  2. print("----- Checking Python -----");
  3.  
  4. import sys
  5.  
  6. def Running27():
  7. # Okay, we're running 2.7. Now check if PyQT is installed.
  8. try:
  9. from PyQt4 import Qt
  10. except:
  11. print("ERROR: failed to import PyQt4");
  12.  
  13.  
  14. major = sys.version_info.major;
  15. minor = sys.version_info.minor;
  16.  
  17. if major == 2 and minor == 7:
  18. Running27();
  19. else:
  20. print("ERROR: The interpreter for this script is not Python 2.7.X");
  21. print("\t The interpreter is " + str(sys.version_info));
  22.  
  23. print("");
  24. print("Hit enter to exit...");
  25. raw_input();
Success #stdin #stdout 0.02s 7172KB
stdin
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot

def window():
   app = QApplication(sys.argv)
   widget = QWidget()

   textLabel = QLabel(widget)
   textLabel.setText("Hello World!")
   textLabel.move(110,85)

   widget.setGeometry(50,50,320,200)
   widget.setWindowTitle("PyQt5 Example")
   widget.show()
   sys.exit(app.exec_())

if __name__ == '__main__':
   window()
stdout
----- Checking Python -----
ERROR: failed to import PyQt4

Hit enter to exit...