While I was fooling around with some Python code, I suddenly thought “How do I make it go ‘BING!’?”
The answer is very simple: import winsound
Make a Python script block and put the following code in it:
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#Here's a bit of fun
import winsound
# Play Windows exit sound. Put this line where you want it to go BING
# winsound.PlaySound("SystemExit", winsound.SND_ALIAS)
# Hmm, I wonder what I could do with this?
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
winsound.PlaySound("SystemExit", winsound.SND_ALIAS)
#Assign your output to the OUT variable.
OUT = 0
This will play the default Windows Exit noise (bl-bl-bl-bl-bing!) when it runs.
Attached is a very, very basic DYN file that does the same thing.BING.dyn (2.2 KB)
Docs for winsound: https://docs.python.org/3/library/winsound.html
So far I have used just the basic Windows standard sounds as very simple audio feedback for when various functions in graphs work or not. Given there is no visual output of errors from Python scripts, this provides a useful way of knowing if a script has run successfully or not, or for finding out how flow works within Dynamo scripts.
edits: spellinge mustokes, Python script errors.