Macro MessageBox: Difference between revisions
mNo edit summary |
Renatorivo (talk | contribs) (languages it) |
||
Line 18: | Line 18: | ||
raise(Exception(msg)) |
raise(Exception(msg)) |
||
{{languages | {{es|Macro_MessageBox/es}} }} |
{{languages | {{es|Macro_MessageBox/es}} {{it|Macro_MessageBox/it}} }} |
Revision as of 20:55, 19 April 2012
Description |
---|
Show how to give information to the user in macros Author: Gaël Ecorchard |
Author |
Gaël Ecorchard |
Download |
None |
Links |
Macros recipes How to install macros How to customize toolbars |
Macro Version |
1.0 |
Date last modified |
None |
FreeCAD Version(s) |
None |
Default shortcut |
None |
See also |
None |
#! /usr/bin/env python # -*- coding: utf-8 -*- """Show how to give information to the user in macros """ from PyQt4 import QtCore, QtGui def errorDialog(msg): # Create a simple dialog QMessageBox # The first argument indicates the icon used: one of QtGui.QMessageBox.{NoIcon, Information, Warning, Critical, Question} diag = QtGui.QMessageBox(QtGui.QMessageBox.Warning, 'Error in macro MessageBox', msg) diag.setWindowModality(QtCore.Qt.ApplicationModal) diag.exec_() msg = 'Example of warning message' errorDialog(msg) raise(Exception(msg))