Window

allows Python to "talk to" the browser.

The Window Object

The window object represents the dicksonui's window.

All available objects, functions, and variables automatically become members of the window object.

Global variables are properties of the window object.

Global functions are methods of the window object.

Even the document objec is a property of the window window.document.getElementById("header");

is the same as:document.getElementById("header");

Window Size

Two properties can be used to determine the size of the window.

Both properties return the sizes in pixels:

  • window.innerHeight - the inner height of the window (in pixels)

  • window.innerWidth - the inner width of the window (in pixels)

The window (the viewport) is NOT including toolbars and scrollbars.

For Internet Explorer 8, 7, 6, 5:

  • document.documentElement.clientHeight

  • document.documentElement.clientWidth

  • or

  • document.body.clientHeight

  • document.body.clientWidth

Other Window Methods

Some other methods:

  • window.open() - open a new window

  • window.close() - close the current window

  • window.moveTo() - move the current window

  • window.resizeTo() - resize the current window

Last updated