Scripted module interaction with "Adjust window level" tool

I would like to know the syntax of the lines of Python code that would allow me to read the window, level values that the user set with the “Adjust Window Level Tool”
into variables in my scripted module.

This link from the Slicer Script Repository details how to use python to set window/level. There are similar methods to get current window level.

Using the python interactor typically located at the bottom of the Slicer main window, you can check out options available by doing the following

volumeNode = getNode('MRHead')
volumeNode.GetDisplayNode().GetWindow # press [Tab] at this point to bring up auto-complete options that begin with GetWindow...

Thanks, I understood how to use the relevant set and get functionalities.
If I have any more issues with this, I’ll reply again on this thread.

I actually do have a follow up question.
What is the recommended way to check if the window level has been changed so that I can update variables containing windowlevelmin and windowlevel max? I want to do something like this:

(#user drags adjust window level tool in any direction).connect(self.updateWindowMinMax)

def updateWindowMinMax(self):
      self.windowmin = self.inputSelector.currentNode().GetDisplayNode().GetWindowLevelMin()

      self.windowmax = self.inputSelector.currentNode().GetDisplayNode().GetWindowLevelMax()