Sorry, "testUI" should be replaced with "UI"

On Sat, Nov 3, 2012 at 12:40 PM, Panupat Chongstitwattana <
[email protected]> wrote:

> about the ui file, you can actually use them as is without converting.
> Make sure you got the right path to the file
>
> from PyQt4 import QtGui, uic
>
> class UI(QtGui.QDialog):
>
>     def __init__( self, parent=None ):
>
>         super( testUI, self ).__init__(parent)
>         self.ui = uic.loadUi("d:/test.ui", self)
>
> test = UI()
> test.show()
>
> You can replace parent=None with parent=getMayaWindow() so that your UI
> will be a child of Maya's window. You can get that function with example
> from Nathan's blog
>
> http://nathanhorne.com/?p=451
>
>
>
> On Sat, Nov 3, 2012 at 12:32 PM, Panupat Chongstitwattana <
> [email protected]> wrote:
>
>> From 2011 onwards, Maya already run in Qt. If you look at this code...
>>
>>
>>     app = QtGui.QApplication(sys.argv)
>>     ex = Example()
>>     sys.exit(app.exec_())
>>
>> app is initiating Qt, that's what crashing with Maya's own Qt.
>>
>> So, inside Maya, you can simply subclass PyQt UI and call the show(). And
>> bam you have it.
>>
>> from PyQt4 import QtGui
>>
>> myUI = QtGui.QMainWindow()
>> myUI.show()
>>
>> Assuming you have the correct PyQt version added to your python path of
>> course :)
>>
>>
>> On Sat, Nov 3, 2012 at 5:18 AM, Justin Israel <[email protected]>wrote:
>>
>>> Hi,
>>>
>>> There have been a lot of PyQt4 for Maya discussion in this group in the
>>> past. You should search and check out some of the great information that
>>> has been covered before.
>>>
>>> But in a nutshell, PyQt must be built against the same matching Qt
>>> version that Maya is using. Simply installing the latest from Riverbank
>>> will not work. Additionally there are some slight difference in general
>>> usage, such as not creating your own QApplication within Maya, because Maya
>>> already has one.
>>>
>>> I have a number of materials on this subject if you want. Here is my
>>> post about PyQt4 in Maya 2011. You didn't mention your operating system,
>>> but these instructions are for OSX (and loosely apply to linux as well).
>>> http://www.justinfx.com/2011/01/07/installing-pyqt-for-maya-2011-osx/
>>> There are also a number of prebuild convenience packages listed on there
>>> for various operating systems. You would need to search around if yours is
>>> not listed.
>>>
>>> Also, I just released a training video on PyQt4 for Maya if you are
>>> interested:
>>> http://www.cmivfx.com/tutorials/view/498/PyQt4+UI+Development+for+Maya
>>>
>>> First things first though, would be to get a compatable PyQt4
>>> installation going. It needs to be PyQt build against Qt 4.5.3
>>>
>>> Hope that helps!
>>> -- justin
>>>
>>>
>>>
>>> On Thu, Oct 25, 2012 at 7:59 AM, illunara <[email protected]> wrote:
>>>
>>>> Hello
>>>>  I'm just getting start with PyQt, so i have some basic question about
>>>> it, please help me out :D
>>>> As i know that pyQt is kind of standalone software develop by Nokia (or
>>>> riverBank), and PyQt when we use with Maya is just a package, so when i try
>>>> to run some PyQt code in maya, it crash. Here is the code i use, i using
>>>> Maya 2011 64bit
>>>>
>>>> import sys
>>>> from PyQt4 import QtGui
>>>>
>>>> class Example(QtGui.QMainWindow):
>>>>
>>>>     def __init__(self):
>>>>         super(Example, self).__init__()
>>>>
>>>>         self.initUI()
>>>>
>>>>     def initUI(self):
>>>>
>>>>         exitAction = QtGui.QAction(QtGui.QIcon('**exit.png'), '&Exit',
>>>> self)
>>>>         exitAction.setShortcut('Ctrl+**Q')
>>>>         exitAction.setStatusTip('Exit application')
>>>>         exitAction.triggered.connect(**QtGui.qApp.quit)
>>>>
>>>>         self.statusBar()
>>>>
>>>>         menubar = self.menuBar()
>>>>         fileMenu = menubar.addMenu('&File')
>>>>         fileMenu.addAction(exitAction)
>>>>
>>>>         self.setGeometry(300, 300, 300, 200)
>>>>         self.setWindowTitle('Menubar')
>>>>         self.show()
>>>>
>>>>
>>>> def main():
>>>>
>>>>     app = QtGui.QApplication(sys.argv)
>>>>     ex = Example()
>>>>     sys.exit(app.exec_())
>>>>
>>>>
>>>> if __name__ == '__main__':
>>>>     main()
>>>>
>>>>
>>>> And i don't know where to code in PyQt application either, In the
>>>> menubar, i chose Form\ViewCode, it gave me a "Unable to lauch
>>>> C:/Python26/Lib/site-packages/**pyQt4/bin/uic" error, i can't convert
>>>> an UI file to Python either. T_T it freaking me out.
>>>>
>>>> Thanks
>>>>
>>>> --
>>>> 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
>>>
>>
>>
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to