Active objects access

How to access the active (selected) objects through the Blender Python API from scripts/add-ons:

  1. The active window (in which current action occurs):

  1. The active scene:

  1. The active (selected) mesh:

  1. The active (selected) material node (in the NODE_EDITOR window):

  1. The current text in TEXT_EDITOR window:

  1. The active (selected) UV-Map:

  1. Current page in the User Preferences window:

  1. Current World:

  1. Current world node tree (Environment):