Package pywm :: Class window
[show private | hide private]
[frames | no frames]

Class window


This class wraps an X window in a form where your python window manager code can manipulate it.

You can subclass this, and pass your subclass into your window manager constructor. This will cause all created windows to be built with your custom window class.
Method Summary
  __init__(self, hWin, wm)
You should not instantiate windows yourself.
  __repr__(self)
  activate(self)
Brings this window to the top, and makes it the active window
  close(self)
Closes the window
  deactivate(self)
Brings this window to the top, and makes it the active window
  getname(self)
Call this to return the current setting of the window's title bar
  getScreenSize(self)
Returns x, y size of the screen as a tuple
  go(self, direction)
Arguments:
  goCentre(self)
Centre the window on the screen
  goEast(self)
Moves the window to the right (east) position
  goNorth(self)
Moves the window to the top (north) position
  goNorthEast(self)
Moves the window to the top right (northeast) position
  goNorthWest(self)
Moves the window to the top (north) position
  goSouth(self)
Moves the window to the top (north) position
  goSouthEast(self)
Moves the window to the bottom right (southeast) position
  goSouthWest(self)
Moves the window to the top (north) position
  goWest(self)
Moves the window to the top (north) position
  grow(self, dw, dh)
Grow from the center by dw, dh
  growBottom(self, dh)
Grow from the bottom by 'dh' pizels.
  growLeft(self, dw)
Grow to the left by 'dw' pizels.
  growRight(self, dw)
Grow to the right by 'dw' pizels.
  growTop(self, dh)
Grow from the top by 'dh' pizels.
  height(self)
  hide(self)
Hides the window off the screen.
  iconise(self)
Iconises this window
  lock(self)
Calling lock on a window prevents that window from being affected by zooming and panning functions
  lower(self)
Lowers this window
  moveDown(self, dy)
Moves window down Arg - dy - is amount to move by, defaults to self.moveIncrement
  moveLeft(self, dx)
Moves window left.
  moveRel(self, dx, dy)
Move the window relative to its present position
  moveRight(self, dx)
Moves window right.
  moveUp(self, dy)
Moves window up.
  on_resize(self, x, y, w, h)
  position(self, x, y)
Gets or sets the window position
  raise_(self)
Raises this window
  resize(self, how)
Resizes the window according to how.
  resizeRel(self, dw, dh)
Resizes window relative to its present size.
  setborder(self, mode)
Sets the window border mode.
  shrink(self, dw, dh)
Shrink from the center by dw, dh
  shrinkBottom(self, dh)
Shrink from the bottom by 'dh' pizels.
  shrinkLeft(self, dw)
Shrink from the left by 'dw' pizels.
  shrinkRight(self, dw)
Shrink from the right by 'dw' pizels.
  shrinkTop(self, dh)
Shrink from the top by 'dh' pizels.
  size(self, w, h)
Gets or sets the window size
  toggleMax(self)
Toggles between existing and maximum size
  toggleMaxHeight(self)
Toggles the height between current and maximum
  toggleMaxWidth(self)
Toggles the height between current and maximum
  unhide(self)
UnHides the window back onto the screen.
  unlock(self)
Calling unlock on a window makes that window susceptible to moving and resizing via zooming and panning functions.
  width(self)

Class Variable Summary
int moveIncrement = 40                                                                    
int sizeIncrement = 40                                                                    

Method Details

__init__(self, hWin, wm)
(Constructor)

You should not instantiate windows yourself. This constructor gets called when the WM engine detects that a window has been created (or a previously known window has been restored into view).

activate(self)

Brings this window to the top, and makes it the active window

close(self)

Closes the window

deactivate(self)

Brings this window to the top, and makes it the active window

getname(self)

Call this to return the current setting of the window's title bar

getScreenSize(self)

Returns x, y size of the screen as a tuple

go(self, direction)

Arguments:
  • direction - the direction to move. One of:
    • n or north - move to top centre of screen
    • ne or northeast - move to top right of screen
    • e or east - move to centre right of screen
    • se or southeast - move to bottom right of screen
    • s or south - move to bottom centre of screen
    • sw or southwest - move to bottom left of screen
    • w or west - move to centre left of screen
    • nw or northwest - move to top oeft of screen
    • c or centre/center - move to centre of screen
    • up - move up a bit
    • down - move down a bit
    • left - move left a bit
    • right - move right a bit

goCentre(self)

Centre the window on the screen

goEast(self)

Moves the window to the right (east) position

goNorth(self)

Moves the window to the top (north) position

goNorthEast(self)

Moves the window to the top right (northeast) position

goNorthWest(self)

Moves the window to the top (north) position

goSouth(self)

Moves the window to the top (north) position

goSouthEast(self)

Moves the window to the bottom right (southeast) position

goSouthWest(self)

Moves the window to the top (north) position

goWest(self)

Moves the window to the top (north) position

grow(self, dw=None, dh=None)

Grow from the center by dw, dh

Arguments:
  • dw - amount to grow by horizontally, default self.sizeIncrement
  • dh - amount to grow by vertically, default self.sizeIncrement

growBottom(self, dh=None)

Grow from the bottom by 'dh' pizels. Default self.sizeIncrement

growLeft(self, dw=None)

Grow to the left by 'dw' pizels. Default self.sizeIncrement

growRight(self, dw=None)

Grow to the right by 'dw' pizels. Default self.sizeIncrement

growTop(self, dh=None)

Grow from the top by 'dh' pizels. Default self.sizeIncrement

hide(self)

Hides the window off the screen.

Note - this will trigger an 'on_destroy' callback, so watch for this in your callback

iconise(self)

Iconises this window

lock(self)

Calling lock on a window prevents that window from being affected by zooming and panning functions

lower(self)

Lowers this window

moveDown(self, dy=None)

Moves window down Arg - dy - is amount to move by, defaults to self.moveIncrement

moveLeft(self, dx=None)

Moves window left. Arg - dx - is amount to move by, defaults to self.moveIncrement

moveRel(self, dx=0, dy=0)

Move the window relative to its present position

Args: dx, dy - if either of these are None, don't move on that axis.

moveRight(self, dx=None)

Moves window right. Arg - dx - is amount to move by, defaults to self.moveIncrement

moveUp(self, dy=None)

Moves window up. Arg - dy - is amount to move by, defaults to self.moveIncrement

position(self, x=None, y=None)

Gets or sets the window position

Call with no arguments to fetch the position as a tuple Call with x,y to set the window position

raise_(self)

Raises this window

resize(self, how)

Resizes the window according to how.

Argument:
  • how - the resize mode:
    • 'taller' - grow vertically
    • 'shorter' - shrink vertically
    • 'wider - grow horizontally
    • 'narrower' - shrink horizontally
    • 'larger' - grow vertically and horizontally
    • 'smaller' - shrink vertically and horizontally

resizeRel(self, dw=0, dh=0)

Resizes window relative to its present size.

Arguments:
  • dw - amount to grow by horizontally - default 0
  • dh - amount to grow by vertically - default 0

setborder(self, mode='normal')

Sets the window border mode.

Argument - mode:
  • if 'normal', sets normal border with titlebar
  • if 'thin', sets thin border - no titlebar
  • if 'none', sets no border or titlebar

shrink(self, dw=None, dh=None)

Shrink from the center by dw, dh

Arguments:
  • dw - amount to shrink by horizontally, default self.sizeIncrement
  • dh - amount to shrink by vertically, default self.sizeIncrement

shrinkBottom(self, dh=None)

Shrink from the bottom by 'dh' pizels. Default self.sizeIncrement

shrinkLeft(self, dw=None)

Shrink from the left by 'dw' pizels. Default self.sizeIncrement

shrinkRight(self, dw=None)

Shrink from the right by 'dw' pizels. Default self.sizeIncrement

shrinkTop(self, dh=None)

Shrink from the top by 'dh' pizels. Default self.sizeIncrement

size(self, w=None, h=None)

Gets or sets the window size

Call with no arguments to fetch the position as a tuple Call with x,y to set the window position

toggleMax(self)

Toggles between existing and maximum size

toggleMaxHeight(self)

Toggles the height between current and maximum

toggleMaxWidth(self)

Toggles the height between current and maximum

unhide(self)

UnHides the window back onto the screen.

Note - this will trigger an 'on_create' callback, so watch for this in your callback

unlock(self)

Calling unlock on a window makes that window susceptible to moving and resizing via zooming and panning functions.

This is the default state when the window gets created.

Class Variable Details

moveIncrement

Type:
int
Value:
40                                                                    

sizeIncrement

Type:
int
Value:
40                                                                    

Generated by Epydoc 2.1 on Mon Feb 27 15:47:09 2006 http://epydoc.sf.net