Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello.
I'm making a tool with GUI by using pyside2 in maya. It has some functions that can be called by clicking buttons a gui has and some of them throw error if needed.
However, "cmds.error()" command won't work as I expected. Whenever I use "cmds.error()" command it shows error in red color in the command line at right bottom corner of maya but this time...
The following code can reproduce the problem I'm facing. The error is not shown in the command line if you click the button.
from PySide2 import QtWidgets
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin
class TestWindow(MayaQWidgetDockableMixin, QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(TestWindow, self).__init__(parent=parent)
self.main_widget = QtWidgets.QWidget()
self.main_layout = QtWidgets.QHBoxLayout()
self.btn = QtWidgets.QPushButton('Throw Error')
self.btn.clicked.connect(self.throw_error)
self.main_layout.addWidget(self.btn)
self.main_widget.setLayout(self.main_layout)
self.setCentralWidget(self.main_widget)
def throw_error(self):
cmds.error('Error')
window = TestWindow()
window.show()
If someone knows the solution of the problem, please help me!
Thank you.
Solved! Go to Solution.