0

I'm trying to use VSCode as my main IDE for Anaconda Custom Python 2.7.13 on MacOS High Sierra. I'm trying to make a file open dialogue box appear using PyQt5. In Spider the following works fine, but not in VS Code: from PyQt5 import QtWidgets files = QtWidgets.QFileDialog.getOpenFileNames()

The error I get in the VSC console is simply Not Available whereas in the context of a larger program I get E1101:Module 'PyQt5.QtWidgets' has no 'QFileDialog' member.

I was wondering whether anyone had any idea where this issue is arising from?

Oli

aydinugur
  • 1,208
  • 2
  • 14
  • 21
Oli
  • 11
  • 4
  • sounds like youre trying to use a property that doesnt exist – mast3rd3mon Nov 13 '17 at 11:30
  • @mast3rd3mon It does indeed! But QFileDialog is an element of QtWidgets. I am able to import the submodule with ```from PyQt5.QtWidgets import QFileDialog``` but not use it! – Oli Nov 13 '17 at 11:45

1 Answers1

0

I ran another QT5 program I was working on that I already knew worked in VSC and added a dialog box. This worked fine, so I created a UI using QT Designer to add it to. It seems that QFileDialog needs an instance of class Ui_Frame() to instantiate. The fact that it worked in Spyder and not VSC may be related to the fact that the UI of Spyder is built on QT.

Oli
  • 11
  • 4