[Tutor] apply help (newbie)

karthik Guru karthikg@aztec.soft.net
Sat, 15 Dec 2001 22:02:35 +0530


import sys
from qt import *


class Button(QPushButton):
	def __init__(self,*args):
		#QPushButton.__init__(self,args)		##### This does not work
		apply(QPushButton.__init__,(self,)+args)  ##### But this works
		self.setText("hello")
		
class MainWindow(QMainWindow):
	def __init__(self,*args):
		#QMainWindow.__init__(self,args)
		apply(QMainWindow.__init__,(self,)+args)
		self.button = Button(self)
		self.setCentralWidget(self.button)
		self.button.show()                                              
    
if __name__ == '__main__':
	args = sys.argv
	app=QApplication(args)                                 
	win= MainWindow()
	win.show()
	app.exec_loop()                                            


can someone tell me as to what is the difference between these 2 calls:

		QPushButton.__init__(self,args)		...1
		apply(QPushButton.__init__,(self,)+args)  ...2


thnx in advance,
karthik.