Ok totally understood, and since in my course of creating PyQt4 apps i am going to create Dockable apps i guess i would use QMainWindow!! just like I have some obsession with creating dockable windows(with cmds module) since the dockControl came up with 2011.
that was a wonderful explanation thanks! BTW what is the IDE you used in PyQt4 tutorial ? On Tue, Dec 4, 2012 at 9:28 PM, Justin Israel <[email protected]>wrote: > Is your confusion that another example used a QMainWindow and mine used a > QDialog? > They are both reasonable choices. QMainWindow has more features than > QDialog if you need a window like that. It supports dock widgets and comes > with more methods immediately intended for a main window like tool bars and > menu bars and status bars. That is not to say you cant do the same with a > dialog. > If what you are creating needs to be a large app that creates its own > dialogs and you need the main window features, then use it. I use a dialog > for apps that just pop up like a dialog look to the maya main window. > They both take the parent keyword argument. In the other example, they set > the maya main window as the default parent. In mine, I just take all the > original args and let you pass the parent yourself. > You can check out the docs to read about the specific differences between > qdialog and qmainwindow. > > - justin > > > On Dec 4, 2012, at 4:04 AM, san <[email protected]> wrote: > > > Hello Justin, > > I had little bit of confusion in the example code of template for PyQt app > for maya , Since i am also referring the Maya Python > Book<http://www.maya-python.com/> > , > in which they make window class that inherits QtGui.QMainWindow while the > one in your code the window class inherits QtGui.QtDialogs > > from PyQt4 import QtCore,QtGui > import SIP > > import maya.cmds as cmds > import maya.OpenMayaUI as mui > > def getMayaMainWindow(QtGui.QMainWindow): > accessMainWindow=mui.MQUtil.mainWindow() > return sip.wrapinstance(long(accessMainWindow),QtCore.QObject) > > class Window(*QtGui.QMainWindow*): > def __init__(self,parent=getMayaMainWindow(), > uniqueHandle='PyQtWindow'): > QtGui.QMainWindow.__init__(self.parent) > self.setWindowTitle('PyQtWindow') > self.setObjectName(uniqueHandle) > self.resize(400,200) > self.setWindow() > def setWindow(self): > #add PyQt window congtrols here in inherited class > pass > > while in case of your example given in PyQt tutorial. > > class Window(*QtGui.QDialog*): > def __init__(self,*args,**kwargs): > super(Window,self).__init__(*args,**kwargs) > # custom code here > self.resize(800,600) > > ##everything else is same > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- ** [image: San's personal blog] <http://feeds.feedburner.com/SanLuthraBlog> * * -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
