The following are the codes that are associated with this opening file of
mine...
So the button in this case, is this openAnimBtn
import maya.cmds as cmds
from PyQt4.QtCore import *
from PyQt4.QtGui import *
def initUI(self):
self.openAnimBtn = QToolButton()
gridLayout = QGridLayout()
gridLayout.addWidget(self.openAnimBtn, 1, 2, 1, 1)
self.setLayout(gridLayout)
def createConnections(self):
self.connect(self.openAnimBtn, SIGNAL('clicked()'), self.openFile)
def openFile(self):
fileFilters = "Text (*.txt)"
fileList = cmds.fileDialog2(fileMode = 1, fileFilter = fileFilters,
dialogStyle = 2)
if fileList:
stringConvert = ''.join(fileList)
print "Imported File is opened from : %s" %stringConvert
self.importTxt.setText(stringConvert)
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/9646e989-2eb3-4764-9eb7-a9368e56d3db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.