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

Conclusion


To conclude, let's summarize some of the key steps involved in designing an application:

  • Depending on what you want to design, choose a suitable data structure to represent your needs logically.

  • If required, combine primitive data structures to form complex structures like, say, a list of dictionaries or a tuple of dictionaries.

  • Create classes for objects that constitute your application. Add attributes that need to be manipulated and methods to manipulate those attributes.

  • Manipulate attributes using different API provided by a rich set of Python standard and external libraries.

We tried to build several partly-functional applications in this book. And then we put up an explanation for the code. However, when you try to explain a software development process in a sequential text, you sometimes mislead your readers to imply that development of software programs is a linear process. This is hardly true.

Actual programming doesn't usually work this way. In fact, small-to-medium-sized programs are normally written in an incremental trial and error process where assumptions get changed and structures modified throughout the course of application development.

Here is how you would develop a small to medium application:

  1. Start with a simple script.

  2. Set a small achievable goal, implement it, and then think of adding the next feature to your program in an incremental fashion.

  3. You may or may not introduce a class structure initially. If you are clear about the problem domain, you may introduce the class structure right from the very beginning.

  4. If you are not sure about the class structure initially, start with simple procedural code. As your program starts to grow, you will probably start getting lot of global variables. It is here that you will start getting a glimpse of the structural dimensions of your program. It is now time to refactor and restructure your program to introduce a class structure.

Tip

If you are writing a small program, the evolutionary trial and error strategy works well.

If, however, you get into developing medium to large-scale applications, it is better to do some serious upfront planning before you sit down to write your code, because the cost of failure of a large program is way higher than what we can generally afford.

An analogy would explain this better. You can build a small shed on a trial and error basis, but you would not attempt to build a skyscraper without some serious planning.

It is also important not to be unnecessarily bogged down by ever evolving jargons in the technical world. Programming is less about knowing a particular API or even a particular programming language. You can literally get to know the basic constructs of a programming language in a small sitting. Programming is rather a tool for finding solution to your immediate problems.

That brings us to the end of the book. I hope this book has taught you something about GUI programming with Python and Tkinter.

Beyond reading books, there is really no substitute for doing some original GUI programming. So, take up an original programming challenge and execute it for the fun of it.

How you implement it is a matter of individual experiences and taste. Do what feels comfortable to you, but keep yourself open to the idea of continuous refactoring at every stage of development.