TruxtonOptions

From truxwiki.com
Jump to navigation Jump to search

This class gives you access to configuration variables in Truxton.

Methods

exists(name: str) -> boolean

This will tell you if the named setting exists in the options. It will return True if the option was specified somewhere, False if the default value will be returned.

getbool(name: str) -> boolean

This will retrieve a boolean setting from Truxton based on its name. If the name setting could not be found, False will be returned.

getinteger(name: str) -> int

This will retrieve an integer setting from Truxton based on its name. If the name setting could not be found, zero will be returned.

getstring(name: str) -> str

This will retrieve a string setting from Truxton based on its name. If the name setting could not be found, an empty string will be returned.

Sample

import sys
sys.path.append('C:/Program Files/Truxton/SDK')
import truxton

def main():
  options = truxton.options()

  print( "CreateTheDatabase: " + str(options.getbool("CreateTheDatabase")))
  print( "dbport: " + str(options.getinteger("dbport")))
  print( "dbname: " + str(options.getstring("dbname")))

if __name__ == "__main__":
  sys.exit(main())