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.

3.1 What is a Widget<br />

3<br />

Overview of Tkinter Widgets<br />

According <strong>to</strong> the Free On-Line Dictionary of Computing, the definition of a widget is:<br />

widget: [possibly evoking ”window gadget”] In graphical user interfaces,<br />

a combination of a graphic symbol <strong>and</strong> some program code <strong>to</strong> perform a<br />

specific function. E.g. a scroll-bar or but<strong>to</strong>n. Windowing systems usually<br />

provide widget libraries containing commonly used widgets drawn in a<br />

certain style <strong>and</strong> with consistent behaviour.<br />

A widget is therefore a graphical object that is available from the Tkinter library. It<br />

is a kind of graphical building block. Intuitively, widgets are implemented as classes in<br />

Tkinter. Each widget therefore has a construc<strong>to</strong>r, a destruc<strong>to</strong>r, its own set of properties<br />

<strong>and</strong> methods, <strong>and</strong> so on. While most other GUI <strong>to</strong>olkits have a very complex widget<br />

hierarchy, Tkinter’s hierarchy is extremely simple. All widgets (like But<strong>to</strong>n, Checkbut<strong>to</strong>n,<br />

etc.) are dereived from the Widget class. All widget subclasses occupy the same<br />

level in the hierachy tree.<br />

3.2 The Different Widgets<br />

3.2.1 Toplevel<br />

The Toplevel is technically not a widget, although this is more or less transparent <strong>to</strong> the<br />

user.

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

Saved successfully!

Ooh no, something went wrong!