Skip to Main Content
Tkinter GUI Application Development Blueprints
book

Tkinter GUI Application Development Blueprints

by Bhaskar Chaudhary
November 2015
Beginner to intermediate content levelBeginner to intermediate
340 pages
7h 29m
English
Packt Publishing
Content preview from Tkinter GUI Application Development Blueprints

Adding toolbar buttons

Next, we need to add 16 buttons to the left toolbar. Further, depending on which button is clicked, different options would show up in the top bar as shown here:

Adding toolbar buttons

We do not want our code structure to be bloated by conditional logic to switch among these 16 functions. Therefore, we will call these methods dynamically.

We first begin by defining a tuple of all 16 function names (see code 6.01.py):

 tool_bar_functions = ( "draw_line", "draw_oval", "draw_rectangle", "draw_arc", "draw_triangle", "draw_star", "draw_irregular_line", "draw_super_shape", "draw_text", "delete_item", "fill_item", "duplicate_item", "move_to_top", "drag_item", ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Python Application Development

Learning Python Application Development

Ninad Sathaye

Publisher Resources

ISBN: 9781785889738Supplemental Content