22.07.2013 Views

A Comprehensive Introduction to Python Programming and ... - MSDL

A Comprehensive Introduction to Python Programming and ... - MSDL

A Comprehensive Introduction to Python Programming and ... - MSDL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.4 The “Place” Geometry Manager 41 / 75<br />

Method Effect<br />

grid(option=value,. . . ),<br />

Places the widget in a grid, using the<br />

grid configure(option=value,. . . ) specified options.<br />

grid forget(), grid remove() The widget is no longer managed<br />

by the Grid manager, but is not destroyed.<br />

grid info() Returns a dictionary containing the<br />

current options.<br />

grid slaves() Returns a list of widget IDs which<br />

are slaves of the master widget.<br />

grid location(x,y) Returns a (column, row) tuple which<br />

represents the cell in the grid that is<br />

closest <strong>to</strong> the point (x, y).<br />

grid size() Returns the size of the grid, in the<br />

form of a (column, row) tuple, in<br />

which column is the index of the<br />

first empty column <strong>and</strong> row the index<br />

of the first empty row.<br />

It is important <strong>to</strong> note that empty rows <strong>and</strong> columns are not displayed by the grid<br />

geometry manager, even if a minimum size is specified. Note: The grid manager cannot<br />

be used in combination with the pack manager, as this results in an infinite negociation<br />

loop.<br />

4.4 The “Place” Geometry Manager<br />

The place geometry manager is the most powerful manager of all since it allows exact<br />

placement of the widgets inside a master widget (container). However, it is more<br />

difficult <strong>to</strong> use <strong>and</strong> usually represents a great amount of overhead that is rarely needed.<br />

The Place geometry manager allows placement of widgets using either exact coordinates<br />

(with the x <strong>and</strong> y options), or as a percentage relative <strong>to</strong> the size of the master<br />

window (expressed as a float in the range [0.0, 1.0]) with the relx <strong>and</strong> rely options.<br />

The same principle holds for the widget size (using width / height <strong>and</strong>/or relwidth /<br />

relheight). The options that can be used in the place() method are:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!