PDA

View Full Version : why we pass sys.argv to QtGui.QApplication() in main method and whats in it list?



krystosan
29th November 2012, 11:38
I started learning PyQt from zetcode, as far as i know sys.argv reads in the parameter from coomandline and first being the name of file itself, so if sys.argv is a list then what being passed to QtGui.QApplication() in


def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())


and what is in the sys.argv list ?

wysota
29th November 2012, 11:45
It's exactly what you said -- a list of command line parameters.

krystosan
29th November 2012, 12:14
what is explicitly passed in those list items when we say sys.argv ?i mean what are those command line parameters

amleto
29th November 2012, 14:17
why don't you start your debugger and find out?

whats in the argument is list exactly the options that you pass on the command line, in addition to the full pathname of the executing binary.

wysota
29th November 2012, 15:37
what is explicitly passed in those list items when we say sys.argv ?i mean what are those command line parameters

Whatever you pass to the program.

ChrisW67
29th November 2012, 22:32
Python sys.argv (http://docs.python.org/2/library/sys.html#sys.argv) is well documented.

Qt is passed the command line arguments to allow it to see, react to, and remove a few options that it can use to set the program style or renderer. The known options are documented in the QApplication constructor docs (http://qt-project.org/doc/qt-4.8/qapplication.html#QApplication).

krystosan
30th November 2012, 04:58
totally understood thanks