'PyQt4 module not found' - Cannot use PyQt to open a GUI

Post here if you need help with creating a Graphical User Interface in Python.

'PyQt4 module not found' - Cannot use PyQt to open a GUI

Postby HelpMeWithPythonPls » Wed Aug 31, 2016 11:20 am

Hi,

I am very new to using PyQt4. So far, i have used QtDesigner to create the GUI windows i shall be using for my program.

However, when i run the first bit of python coding to get the user interface to appear, i get an error i cannot find a solution to.

Heres the code:
Code: Select all
import sys, os
from PyQt4 import QtCore, QtGui, uic

form_class = uic.loadUiType("HomeScreen.ui") [0]


All i am trying to do with this is to load a GUI, which is called 'HomeScreen.ui'.

Upon running this code, the python shell returns an error saying:

Code: Select all
from PyQt4 import QtCore, QtGui, uic

ImportError: No module named 'PyQt4'


I have Python 3.5 installed, as well as PyQt v4.11.4 and PyQt5.6.

'QtGui' and 'QtCore' are both saved in a folder called PyQt4 (and PyQt5), which are both stored in the path: C:\Program Files (x86)\Python\Python35-32\Lib\site-packages

I believe this is where third party modules are supposed to be stored, but python can never find the module and i repeatedly get the same error message.

Any help would be appreciated.

Thanks
Last edited by Yoriz on Wed Aug 31, 2016 11:50 am, edited 1 time in total.
Reason: First post lock.
HelpMeWithPythonPls
 
Posts: 2
Joined: Wed Aug 31, 2016 11:15 am

Re: 'PyQt4 module not found' - Cannot use PyQt to open a GUI

Postby Larz60+ » Wed Aug 31, 2016 3:42 pm

Hello,

First you need to convert the .ui file to python.
This is done with pyuic4 (see http://stackoverflow.com/questions/18429452/convert-pyqt-ui-to-python)

Larz60+
Larz60+
 
Posts: 1307
Joined: Thu Apr 03, 2014 4:06 pm

Re: 'PyQt4 module not found' - Cannot use PyQt to open a GUI

Postby HelpMeWithPythonPls » Mon Sep 05, 2016 7:46 pm

Hi Larz60+

I have solved the issue i was having, and the Python software will now recognise the PyQt4 module.

Thanks for your help.
HelpMeWithPythonPls
 
Posts: 2
Joined: Wed Aug 31, 2016 11:15 am


Return to GUI

Who is online

Users browsing this forum: Bing [Bot] and 2 guests