Last active
June 12, 2025 05:47
-
-
Save raspberrypisig/17f6b8b944e5c89a49be0d3129296883 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """Show how to give information to the user in macros | |
| """ | |
| from PySide import QtCore, QtGui | |
| def messageDialog(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_() | |
| s = Gui.Selection.getSelection()[0] | |
| volume = str(round(s.Shape.Volume, 1)) | |
| messageDialog(f"Volume: {volume}mm³") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment