Skip to content

Instantly share code, notes, and snippets.

@mclavan
Created February 21, 2015 22:13
Show Gist options
  • Save mclavan/9d53a0f630c7bdcaf8f8 to your computer and use it in GitHub Desktop.
Save mclavan/9d53a0f630c7bdcaf8f8 to your computer and use it in GitHub Desktop.
def get_icon_path(icon_name, icon_folder='icons'):
'''
The point of this function is ot return the location of
a icon in an adjacent folder next to the script.
Make sure ot import this script into the scirpt you want to use it.
Then you can use the path_tools.get_icon_path('icon.png') anywhere you
need to implant an image path.
How to Run:
import path_tools
# Use the path
pm.symbolButton(image=path_tools.get_icon_path('icon.png'))
'''
# os.path.split breaks up a file path.
base_path = os.path.split(__file__)
# Pieces together the full icon path.
full_path = os.path.join(base_path, icon_folder, icon_name)
return full_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment