Tkinter GUI Application Development Blueprints
eBook - ePub

Tkinter GUI Application Development Blueprints

Bhaskar Chaudhary

Compartir libro
  1. 340 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Tkinter GUI Application Development Blueprints

Bhaskar Chaudhary

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Master GUI programming in Tkinter as you design, implement, and deliver ten real-world applications from start to finishAbout This Book• Conceptualize and build state-of-art GUI applications with Tkinter• Tackle the complexity of just about any size GUI application with a structured and scalable approach• A project-based, practical guide to get hands-on into Tkinter GUI developmentWho This Book Is ForSoftware developers, scientists, researchers, engineers, students, or programming hobbyists with basic familiarity in Python will find this book interesting and informative. People familiar with basic programming constructs in other programming language can also catch up with some brief reading on Python. No GUI programming experience is expected.What You Will Learn• Get to know the basic concepts of GUI programming, such as Tkinter top-level widgets, geometry management, event handling, using callbacks, custom styling, and dialogs• Create apps that can be scaled in size or complexity without breaking down the core• Write your own GUI framework for maximum code reuse• Build apps using both procedural and OOP styles, understanding the strengths and limitations of both styles• Learn to structure and build large GUI applications based on Model-View-Controller (MVC) architecture• Build multithreaded and database-driven apps• Create apps that leverage resources from the network• Learn basics of 2D and 3D animation in GUI applications• Develop apps that can persist application data with object serialization and tools such as configparserIn DetailTkinter is the built-in GUI package that comes with standard Python distributions. It is a cross-platform package, which means you build once and deploy everywhere. It is simple to use and intuitive in nature, making it suitable for programmers and non-programmers alike.This book will help you master the art of GUI programming. It delivers the bigger picture of GUI programming by building real-world, productive, and fun applications such as a text editor, drum machine, game of chess, media player, drawing application, chat application, screen saver, port scanner, and many more. In every project, you will build on the skills acquired in the previous project and gain more expertise.You will learn to write multithreaded programs, network programs, database driven programs and more. You will also get to know the modern best practices involved in writing GUI apps. With its rich source of sample code, you can build upon the knowledge gained with this book and use it in your own projects in the discipline of your choice.Style and approachAn easy-to-follow guide, full of hands-on examples of real-world GUI programs. The first chapter is a must read as it explains most of the things you need to get started with writing GUI programs with Tkinter. Each subsequent chapter is a stand-alone project that discusses some aspects of GUI programming in detail. These chapters can be read sequentially or randomly depending upon the readers experience with Python.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Tkinter GUI Application Development Blueprints un PDF/ePUB en línea?
Sí, puedes acceder a Tkinter GUI Application Development Blueprints de Bhaskar Chaudhary en formato PDF o ePUB, así como a otros libros populares de Informatique y Programmation en Python. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2015
ISBN
9781785885099
Edición
1
Categoría
Informatique

Tkinter GUI Application Development Blueprints


Table of Contents

Tkinter GUI Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Meet Tkinter
Objectives of this chapter
Installing Python and Tkinter
Importing Tkinter
GUI programming – the big picture
The root window – your drawing board
Widgets – the building blocks of GUI programs
Some important widget features
Ways to create widgets
Getting to know the core Tkinter widgets
Adding widgets to a parent window
The Tkinter geometry manager
The pack geometry manager
The grid geometry manager
The place geometry manager
Events and callbacks – adding life to programs
Command binding
Passing arguments to callbacks
Limitations of the command option
Event binding
Event patterns
The levels of binding
Handling widget-specific variables
Event unbinding and virtual events
Doing it in style
Specifying styles
Some common root window options
Getting interactive help
Summary
2. Making a Text Editor
Objectives of the chapter
An overview of the chapter
Setting up the editor skeleton
Adding a menu and menu items
Adding menu items
Implementing the View menu
Adding a built-in functionality
Indexing and tagging
Index
Tags
Implementing the Select All feature
Implementing the Find Text feature
Types of Toplevel windows
Working with forms and dialogs
Working with message boxes
The icons toolbar and View menu functions
Displaying the line number
Adding the cursor information bar
Adding themes
Creating the context/pop-up menu
Summary
3. Programmable Drum Machine
An overview of the chapter
Module requirements for the chapter
Setting up the GUI in OOP
Finalizing the data structure
Creating broader visual elements
Defining getter and setter methods
The number of units and beats per unit features
Loading drum samples
Playing the drum machine
Initializing pygame
Playing complete patterns
Determining the tempo of a rhythm
Tkinter and threading
Tkinter and thread safety
Support for multiple beat patterns
Saving beat patterns
Working with ttk-themed widgets
Summary
4. A Game of Chess
An overview of the chapter
Module requirements for this chapter
Structuring our program
Modeling the data structures
Convention on naming chess pieces
Convention for naming locations on the chessboard
Creating a Piece class
Displaying chess pieces on the chessboard
Defining rules for the chess pieces
Rules for the King, Queen, Rook, and Bishop
Rules for a Knight
Rules for a Pawn
The movement validation of chess pieces
Tracking all the available moves
Finding out the current position of the King
Checking whether the King is in check
Making the game functional
Getting the source and destination position
Collecting a list of the moves that need to be highlighted
Highlighting allowed moves
Pre move validation
Recording a move in the data structure
Keep game statistics
Managing user preferences
Summary
5. Building an Audio Player
An overview of the chapter
External library requirements
The pyglet module
PMW Tkinter extension
Program structure and broadview skeleton
Deciding the data structure
Creating the Player class
Adding and removing items from a playlist
Adding a single audio file
Removing the selected files from a playlist
Adding all files from a directory
Emptying the playlist
Playing audio and adding audio controls
Adding the play/stop function
Adding the pause/unpause function
Adding the mute/unmute function
Fast forward/rewind function
Adding the next track/previous track function
Adding the volume change function
Creating a seek bar
One-time updates during audio playback
Managing continuous updates
Looping over tracks
Adding a tooltip
PMW list of extensions
Widgets
Dialogs
Miscellaneous
Summary
6. Paint Application
Creating a tiny framework
Setting up a broad GUI structure
Dealing with mouse events
Adding toolbar buttons
Drawing items on the canvas
Adding a color palette
Adding top bar options for draw methods
Drawing irregular lines and super shapes
Drawing irregular lines
Drawing super shapes
Adding functionality to the remaining buttons
Adding functionality to menu items
Summary
7. Multiple Fun Projects
Chapter objectives
Building a screen saver
Building a Snake game
Creating a Weather Reporter
A simple socket demo
Building a port scanner
Building a chat application
Creating a phone book application
Creating a new record
Reading from the database
Updating records
Deleting records
Graphing with Tkinter
3D graphics with Tkinter
Summary
8. Miscellaneous Tips
Chapter objectives
Tracing Tkinter variables
Widget traversal
Validating user input
Key validation mode demo
Focus out validation mode demo
Formatting widget data
More on fonts
Finer control over font
Building a font selector
Redirecting the command-line output to Tkinter
The class hierarchy of Tkinter
Tips for program design
The model-first policy versus the code-first policy
Separating the model from the view
Selecting the right data structure
Naming variables and methods
The Single Responsibility Principle
Loose coupling
Handling errors and exceptions
Tips for program optimization
Using filter and map
Optimize variables
Profiling your program
Other optimization tips
Distributing a Tkinter application
py2exe
py2app
PyInstaller
Other freezing tools
The limitations of Tkinter
A limited number of core widgets
Non-Python objects
No support for printing ...

Índice