Skip to content

Instantly share code, notes, and snippets.

@raspberrypisig
Last active June 12, 2025 05:47
Show Gist options
  • Select an option

  • Save raspberrypisig/17f6b8b944e5c89a49be0d3129296883 to your computer and use it in GitHub Desktop.

Select an option

Save raspberrypisig/17f6b8b944e5c89a49be0d3129296883 to your computer and use it in GitHub Desktop.
#! /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