No autocomplete for PyQt4 in PyCharm

2019-04-12 03:46发布

On my office PC I'm using

  • Python 3.4
  • PyQt4 Version 4.11.1
  • PyCharm Community Eddition 3.4.1

I installed everything in the order as stated above.

However, code completion does not work. It works for imports, but not for classes and methods.

I made a small sample program:

import sys
from PyQt4 import QtGui


app = QtGui.QApplication(sys.argv)

window = QtGui.QWidget()

window.setWindowTitle("Test")
window.resize(300, 200)
window.show()

sys.exit(app.exec_())

In the code above none of the classes or methods were suggested by PyCharm.

If I type window.setW I would expect it to suggest setWindowTitle() but it doesn't.

Strange thing is, that I'm using the same setup on my computer at home and there it works like a (Py)charm... Autocompletion, auto imports, etc. As far as I remember I installed it the same way as I did on my office PC.

I already looked at some similiar questions but this question has no answers and others don't contain relevant information that helped me so far.


Don't know if it is relevant but at this line

from PyQt4 import QtGui

PyCharm tells me

Unresolved reference 'QtGui'

Maybe the reason for this is the same.

3条回答
啃猪蹄的小仙女
2楼-- · 2019-04-12 04:14

I went through the same issue recently. Unfortunately, the install order didn't solve it for me.

There is a bug report here. Downloading the Early Access Program release worked and can be found here

查看更多
Melony?
3楼-- · 2019-04-12 04:16

I had the same problem on Linux, pyqt5 and pycharm CE. The solution was to rebuild the skeletons with: File > Invalidate Caches / Restart > Invalidate and Restart.

查看更多
Melony?
4楼-- · 2019-04-12 04:25

The problem was solved by installing PyCharm first and then Python and PyQt.

Afterwards I had to configure the interpreter in PyCharm and it worked.

When I posted the question I installed Python, then PyQt and then PyCharm.

Oddly enough, it worked in this order on another PC.

查看更多
登录 后发表回答