if __name__ == '__main__': # create application app = QApplication(sys.argv) app.setApplicationName('My PyQt4 QtGui Project') # create widget w = MainWindow() w.setWindowTitle('My PyQt4 QtGui Project') w.show() # connection QObject.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()')) # execute application sys.exit(app.exec_()) ############################ open()
This is from my EvalPyQt example project (except for the last line). All IDEs were set up with this project. Then everything after
if __name__ == '__main__':
in main.py
was removed and the document saved. Then the code was retyped.
if __name__ == '__main__': # create application app = QApplication(sys.argv) # good app.setApplicationName('My PyQt4 QtGui Project') # requesting completion removed calltip # create widget w = MainWindow() # good w.setWindowTitle('My PyQt4 QtGui Project') # w's setWindowTitle not detected, no calltip w.show() # w's show not detected # connection QObject.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()')) # completion inserted useful placeholders :-))) # execute application sys.exit(app.exec_()) # good ############################ open() # good, placeholder inserted
⇒ Major disadvantage over Spyder: calltips disappear the instant you hit a completing ')' – even when auto-close brackets is enabled. Disabling autoclose ')' also disables autoclose of ']', and '}' Syntax error markers can be slow and obtrusive.
if __name__ == '__main__': # create application app = QApplication(sys.argv) # good app.setApplicationName('My PyQt4 QtGui Project') # good # create widget w = MainWindow() # didn't find MainWindow w.setWindowTitle('My PyQt4 QtGui Project') # didn't find setWindowTitle w.show() # didn't find show # connection QObject.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()')) # good # execute application sys.exit(app.exec_()) #good ############################ open() # calltip very helpful
Calltips remain onscreen throughout typing.
if __name__ == '__main__': # create application app = QApplication(sys.argv) # didn't detect sys.argv app.setApplicationName('My PyQt4 QtGui Project') # slow to find stuff # create widget w = MainWindow() # good w.setWindowTitle('My PyQt4 QtGui Project') # suggested all sorts of irrelevant stuff w.show() # suggested all sorts of irrelevant stuff # connection QObject.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()')) # suggested all sorts of irrelevant stuff, calltip useful # found and suggested SIGNAL and SLOT! # execute application sys.exit(app.exec_()) # found app.exec_ but also suggested all sorts of irrelevant stuff ############################ open() # didn't find built-in open but suggested many others
Calltips remain onscreen throughout typing.
if __name__ == '__main__': # create application app = QApplication(sys.argv) # good app.setApplicationName('My PyQt4 QtGui Project') # good # create widget w = MainWindow() # good w.setWindowTitle('My PyQt4 QtGui Project') # ac, didn't find setWindowTitle method; calltip suggested useful stuff w.show() # ac, didn't find show method; calltip suggested useful stuff # connection QObject.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()')) # good; didn't find SIGNAL ac but found calltip # execute application sys.exit(app.exec_()) # app.exec_ calling was irrelevant ############################ open() # didn't find built-in open but suggested many others
Calltips remain onscreen throughout typing.
if __name__ == '__main__': # create application app = QApplication(sys.argv) # worked, but calltip/doc not that helpful app.setApplicationName('My PyQt4 QtGui Project') # good # create widget w = MainWindow() # good w.setWindowTitle('My PyQt4 QtGui Project') # w's setWindowTitle not detected, no calltip w.show() # w's show not detected # connection QObject.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()')) # good, calltip/doc not that helpful # no help at all in suggesting signals and slots # execute application sys.exit(app.exec_()) # no ac until 'sys.e', calltip not helpful; ac at 'app.e', calltip helpful! ############################ open() # completion at 'o', calltip/doc is helpful
A huge win for Spyder is that the docs remain onscreen after the calltips have disappeared. Syntax error markers can be very slow.