W
W
wertyBSD2012-12-19 14:10:43
Python
wertyBSD, 2012-12-19 14:10:43

How to connect PyQt-win to Python?

I want to try to make a window application in Python under Windows
I downloaded and installed python. Console examples work fine.
When sending the window example for compilation, it gives an error:
Traceback (most recent call last):
File "D:\win.pyw", line 2, in from PyQt4.QtGui import * # interface components
ImportError: No module named 'PyQt4'

code here such:

import sys
from PyQt4.QtGui import *  # компоненты интерфейса
 
# Каждое приложение должно создать объект QApplication
# sys.argv - список аргументов командной строки
application = QApplication(sys.argv)
 
# QWidget - базовый класс для всех объектов интерфейса
# пользователя; если использовать для виджета конструктор
# без родителя, такой виджет станет окном
widget = QWidget()
 
widget.resize(320, 240)  # изменить размеры виджета
widget.setWindowTitle("Hello, World!")  # установить заголовок
widget.show()  # отобразить окно на экране
 
sys.exit(application.exec_())


I downloaded the PyQt-win-gpl-4.9.6 archive
, I don’t know what to do with it, there is no installation. I tried to throw inside the installed python

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
TyVik, 2012-12-19
@wertyBSD

Look towards pip . This wonderful thing can install packages itself (as well as delete, update, etc.).
Installation will fit in just one line: pip install pyqt

P
ProstoTyoma, 2012-12-19
@ProstoTyoma

There are exe files here, these are ready-made installers.
In the archive, the sources, judging by the README, they will have to be collected, and this is most likely a big hemorrhoids.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question