WallGo.utils

Functions

clamp(x, min, max)

Clamp x in range [min, max], inclusive.

getSafePathToResource(relativePathToResource)

Gives a safe path to a packaged resource.

clamp(x, min, max)[source]

Clamp x in range [min, max], inclusive.

Parameters:
  • x (float)

  • min (float)

  • max (float)

Return type:

float

getSafePathToResource(relativePathToResource)[source]

Gives a safe path to a packaged resource. The input is a relative path from WallGo package directory (ie. where __init__.py is located). Use this function to convert the relative path to a path that is safe to use in packaged context. Example relative path: /Data/Something/example.txt.

Returns:

Path to the resource file

Return type:

str.

Parameters:

relativePathToResource (str)