Book Image

Tkinter GUI Application Development HOTSHOT

By : Bhaskar Chaudhary
Book Image

Tkinter GUI Application Development HOTSHOT

By: Bhaskar Chaudhary

Overview of this book

<p>Tkinter is the built-in GUI package that comes with standard python distributions. This means it is easy to get started right away, without any extra installation or configuration. Tkinter’s strength lies in its simplicity of use and its intuitive nature which makes it suited for programmers and non-programmers alike. Once you get started, you will be surprised to see how a few lines of code can produce powerful GUI applications.</p> <p>Tkinter GUI Application Development Hotshot helps you learn the art of GUI programming—building real-world, productive and fun applications like text editor, drum machine, game of chess, media player, drawing application and many more. Each subsequent project builds on the skills acquired in the previous project. Also, learn to write multi-threaded and multi layered applications using Tkinter. Get to know modern best practices involved in writing GUI programs. Tkinter GUI Application Development Hotshot comes with a rich source of sample codes that you can use in your own projects in any discipline of your choice.</p> <p>Starting with a high level overview of Tkinter that covers the most important concepts involved in writing a GUI application, the book then takes you through a series of real world projects of increasing complexity, developing one project per chapter. After you have developed five full projects, the book provides you with some bare-bone skeleton codes for a few functional but incomplete projects, challenging you to put your skills to test by completing them.</p> <p>Finally, you are provided with tips for writing reusable, scalable, and quality GUI code for larger projects. The appendices provide a quick reference sheet for Tkinter.</p>
Table of Contents (16 chapters)
Tkinter GUI Application Development HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The grid manager


The grid is easy to implement and equally easy to modify, making it the most popular choice for most use cases. Following is a list of methods and options available for layout management with the grid() geometry manager:

Methods defined here

Description

bbox = grid_bbox(self, column=None, row=None, col2=None, row2=None) from Tkinter.Misc

Return a tuple of integer coordinates for the bounding box of this widget controlled by the geometry manager grid.

If column, row is given, the bounding box applies from the cell with row and column 0 to the specified cell. If col2 and row2 are given, the bounding box starts at that cell.

The returned integers specify the offset of the upper left corner in the master widget and the width and height.

columnconfigure = grid_columnconfigure(self, index, cnf={}, **kw) from Tkinter.Misc

Configures column index of a grid.

Valid resources are minsize (minimum size of the column),weight (how much does additional space propagate to this column), and pad (how much space to let additionally).

grid = config = configure = grid_configure(self, cnf={}, **kw)

Position a widget in the parent widget in a grid. Use as options:

  • column=number: use cell identified with given column (starting with 0)

  • columnspan=number: this widget will span several columns

  • in=master: use master to contain this widget

  • in_=master: see 'in' option description

  • ipadx=amount: add internal padding in x direction

  • ipady=amount: add internal padding in y direction

  • padx=amount: add padding in x direction

  • pady=amount: add padding in y direction

  • row=number: use cell identified with given row (starting with 0)

  • rowspan=number: this widget will span several rows

  • sticky=NSEW: if cell is larger on which sides will this widget stick to the cell boundary

forget = grid_forget(self)

Un-map this widget.

info = grid_info(self)

Return information about the options for positioning this widget in a grid.

grid_location(self, x, y) from Tkinter.Misc

Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.

grid_propagate(self, flag=['_noarg_']) from Tkinter.Misc

Set or get the status for propagation of geometry information.

A Boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given, the current setting will be returned.

grid_remove(self)

Un-map this widget, but remember the grid options.

grid_rowconfigure(self, index, cnf={}, **kw) from Tkinter.Misc

Configure row index of a grid.

Valid resources are minsize (minimum size of the row),weight (how much does additional space propagate to this row), and pad (how much space to let additionally) .

size = grid_size(self) from Tkinter.Misc

Return a tuple of the number of column and rows in the grid.

slaves = grid_slaves(self, row=None, column=None) from Tkinter.Misc

Return a list of all slaves of this widget in its packing order.

location = grid_location(self, x, y) from Tkinter.Misc

Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.

propagate = grid_propagate(self, flag=['_noarg_']) from Tkinter.Misc

Set or get the status for propagation of geometry information.

A Boolean argument specifies whether the geometry information of the slaves will determine the size of this widget. If no argument is given, the current setting will be returned.

rowconfigure = grid_rowconfigure(self, index, cnf={}, **kw) from Tkinter.Misc

Configure row INDEX of a grid.

Valid resources are minsize (minimum size of the row),weight (how much does additional space propagate to this row), and pad (how much space to let additionally).