Have below code now, but it does not run with 2 errors:
# Invalid get index 'CONTENT_SCALE_MODE_VIEWPORT' (on base: 'SceneTree').
get_tree().set_content_scale_mode(SceneTree.CONTENT_SCALE_MODE_VIEWPORT)
if (VisualsCore.KeepAspectRatio == 0):
get_tree().set_content_scale_aspect(SceneTree.CONTENT_SCALE_ASPECT_KEEP_WIDTH)
elif (VisualsCore.KeepAspectRatio == 1):
# Invalid get index 'CONTENT_SCALE_ASPECT_IGNORE' (on base: 'SceneTree').
get_tree().set_content_scale_aspect(SceneTree.CONTENT_SCALE_ASPECT_IGNORE)