If you find yourself writing a complex script, it can often be helpful to provide documentation for your script in the form of a web page. A great way to do that is to include an easy way to show that page to the user. In this example, we'll create a simple script that will open a given URL in the user's default web browser.
Create a new script and add the following code:
import maya.cmds as cmds def showHelp(): cmds.showHelp("http://www.adrianherbez.net", absolute=True) showHelp()
Run the script, and you'll see the specified URL appear in your default browser.
All we're really doing here is using the showHelp
command. It's a bit misleading, as the showHelp
command is also used to show Maya's documentation for a specific command. However, as long as you specify the absolute flag to true, you can pass in a full path to the URL you would like to open:
cmds.showHelp("http://www.adrianherbez.net", absolute=True)
Note that there are...