Spyder and autocompletion.

122 views
Skip to first unread message

Paul Solo

unread,
Mar 31, 2019, 3:10:05 PM3/31/19
to spyder
Hello.
When i define a class derived from another class(from the PyQt5, or another package), i got no autocomplete inside(i type "self." and got nothing except the variables and methods that i defined explicitly, so i got method __init__ in that case, and none of the methods and variables of the parent class).
I tried PyCharm, it gives me a bunch of methods and variables in autocompletion in the exact same code. But PyCharm isnt an option(Spyder much more interactive).
So question is: Is that autocomplete works as it designed or there is some problems with my installation?

Paul Solo

unread,
Apr 1, 2019, 7:07:37 AM4/1/19
to spyder
For example:
import PyQt5.QtGui as qt_gui
import PyQt5.QtWidgets as qt_widgets
import PyQt5.QtCore as qt_core
import sys

class Color(qt_widgets.QWidget):
def __init__(self, color, *args,**kwargs):
super(Color,self).__init__(*args,**kwargs)
self.setAutoFillBackground(True)

palette = self.palette()
palette.setColor(qt_gui.QPalette.Window, qt_gui.QColor(color))
self.setPalette(palette)

class MainWindow(qt_widgets.QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.setWindowTitle("TestApp")
#label = qt_widgets.QLabel("Label")
# label.setAlignment(qt_core.Qt.AlignCenter)
self.
layout = qt_widgets.QVBoxLayout()
layout.addWidget(Color("white"))
layout.addWidget(Color("blue"))
layout.addWidget(Color("red"))
widget = qt_widgets.QWidget()
widget.setLayout(layout)
# widget = Color("red")
self.setCentralWidget(widget)

app = qt_widgets.QApplication(sys.argv)

window = MainWindow()
window.show()
app.exec_()

 In my installation of the Spyder(3.3.3) auto-completion shows only "__init__", and my installation of the Pycharm shows many methods from the
QMainWindow(the base class of my class) and QWidget(base class of QMainWindow).

IKEANUMBA DEMIAN

unread,
Apr 2, 2019, 7:25:44 AM4/2/19
to spyder

hi please how can i install vtk on my anaconda
iv tried several approach
 

bcolsen

unread,
Apr 2, 2019, 7:25:44 AM4/2/19
to spyder
This code completes properly with the latest spyder master, and should work when Spyder 4 beta 2 come out.
Reply all
Reply to author
Forward
0 new messages