Python GUI Programming Cookbook - Second Edition

Master over 80 object-oriented recipes to create amazing GUIs in Python and revolutionize your applications today
Preview in Mapt

Python GUI Programming Cookbook - Second Edition

Burkhard A. Meier

4 customer reviews
Master over 80 object-oriented recipes to create amazing GUIs in Python and revolutionize your applications today
Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Python GUI Programming Cookbook - Second Edition Book Cover
Python GUI Programming Cookbook - Second Edition
$ 39.99
$ 28.00
Python Network Programming Cookbook - Second Edition Book Cover
Python Network Programming Cookbook - Second Edition
$ 39.99
$ 28.00
Buy 2 for $35.00
Save $44.98
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781787129450
Paperback422 pages

Book Description

Python is a multi-domain, interpreted programming language. It is a widely used general-purpose, high-level programming language. It is often used as a scripting language because of its forgiving syntax and compatibility with a wide variety of different eco-systems. Python GUI Programming Cookbook follows a task-based approach to help you create beautiful and very effective GUIs with the least amount of code necessary.

This book will guide you through the very basics of creating a fully functional GUI in Python with only a few lines of code. Each and every recipe adds more widgets to the GUIs we are creating. While the cookbook recipes all stand on their own, there is a common theme running through all of them. As our GUIs keep expanding, using more and more widgets, we start to talk to networks, databases, and graphical libraries that greatly enhance our GUI’s functionality. This book is what you need to expand your knowledge on the subject of GUIs, and make sure you’re not missing out in the long run.

Table of Contents

Chapter 1: Creating the GUI Form and Adding Widgets
Introduction
Creating our first Python GUI
Preventing the GUI from being resized
Adding a label to the GUI form
Creating buttons and changing their text property
Text box widgets
Setting the focus to a widget and disabling widgets
Combo box widgets
Creating a check button with different initial states
Using radio button widgets
Using scrolled text widgets
Adding several widgets in a loop
Chapter 2: Layout Management
Introduction
Arranging several labels within a label frame widget
Using padding to add space around widgets
How widgets dynamically expand the GUI
Aligning the GUI widgets by embedding frames within frames
Creating menu bars
Creating tabbed widgets
Using the grid layout manager
Chapter 3: Look and Feel Customization
Introduction
Creating message boxes – information, warning, and error
How to create independent message boxes
How to create the title of a tkinter window form
Changing the icon of the main root window
Using a spin box control
Relief, sunken and raised appearance of widgets
Creating tooltips using Python
Adding a progressbar to the GUI
How to use the canvas widget
Chapter 4: Data and Classes
Introduction
How to use StringVar()
How to get data from a widget
Using module-level global variables
How coding in classes can improve the GUI
Writing callback functions
Creating reusable GUI components
Chapter 5: Matplotlib Charts
Introduction
Creating beautiful charts using Matplotlib
Installing Matplotlib using pip with whl extension
Creating our first chart
Placing labels on charts
How to give the chart a legend
Scaling charts
Adjusting the scale of charts dynamically
Chapter 6: Threads and Networking
Introduction
How to create multiple threads
Starting a thread
Stopping a thread
How to use queues
Passing queues among different modules
Using dialog widgets to copy files to your network
Using TCP/IP to communicate via networks
Using urlopen to read data from websites
Chapter 7: Storing Data in our MySQL Database via our GUI
Introduction
Installing and connecting to a MySQL server from Python 
Configuring the MySQL database connection
Designing the Python GUI database
Using the SQL INSERT command
Using the SQL UPDATE command
Using the SQL DELETE command
Storing and retrieving data from our MySQL database
Using the MySQL workbench
Chapter 8: Internationalization and Testing
Introduction
Displaying widget text in different languages
Changing the entire GUI language, all at once
Localizing the GUI
Preparing the GUI for internationalization
How to design a GUI in an agile fashion
Do we need to test the GUI code?
Setting debug watches
Configuring different debug output levels
Creating self-testing code using Python's __main__ section
Creating robust GUIs using unit tests
How to write unit tests using the Eclipse PyDev IDE
Chapter 9: Extending Our GUI with the wxPython Library
Introduction
Installing the wxPython library
Creating our GUI in wxPython
Quickly adding controls using wxPython
Trying to embed a main wxPython app in a main tkinter app
Trying to embed our tkinter GUI code into wxPython
Using Python to control two different GUI frameworks
Communicating between the two connected GUIs
Chapter 10: Creating Amazing 3D GUIs with PyOpenGL and PyGLet
Introduction
PyOpenGL transforms our GUI
Our GUI in 3D!
Using bitmaps to make our GUI pretty
PyGLet transforms our GUI easier than PyOpenGL
Our GUI in amazing colors
OpenGL animation
Creating a slide show using tkinter
Chapter 11: Best Practices
Introduction
Avoiding spaghetti code
Using __init__ to connect modules
Mixing fall-down and OOP coding
Using a code naming convention
When not to use OOP
How to use design patterns successfully
Avoiding complexity
GUI design using multiple notebooks

What You Will Learn

  • Create the GUI Form and add widgets
  • Arrange the widgets using layout managers
  • Use object-oriented programming to create GUIs
  • Create Matplotlib charts
  • Use threads and talking to networks
  • Talk to a MySQL database via the GUI
  • Perform unit-testing and internationalizing the GUI
  • Extend the GUI with third-party graphical libraries
  • Get to know the best practices to create GUIs

Authors

Table of Contents

Chapter 1: Creating the GUI Form and Adding Widgets
Introduction
Creating our first Python GUI
Preventing the GUI from being resized
Adding a label to the GUI form
Creating buttons and changing their text property
Text box widgets
Setting the focus to a widget and disabling widgets
Combo box widgets
Creating a check button with different initial states
Using radio button widgets
Using scrolled text widgets
Adding several widgets in a loop
Chapter 2: Layout Management
Introduction
Arranging several labels within a label frame widget
Using padding to add space around widgets
How widgets dynamically expand the GUI
Aligning the GUI widgets by embedding frames within frames
Creating menu bars
Creating tabbed widgets
Using the grid layout manager
Chapter 3: Look and Feel Customization
Introduction
Creating message boxes – information, warning, and error
How to create independent message boxes
How to create the title of a tkinter window form
Changing the icon of the main root window
Using a spin box control
Relief, sunken and raised appearance of widgets
Creating tooltips using Python
Adding a progressbar to the GUI
How to use the canvas widget
Chapter 4: Data and Classes
Introduction
How to use StringVar()
How to get data from a widget
Using module-level global variables
How coding in classes can improve the GUI
Writing callback functions
Creating reusable GUI components
Chapter 5: Matplotlib Charts
Introduction
Creating beautiful charts using Matplotlib
Installing Matplotlib using pip with whl extension
Creating our first chart
Placing labels on charts
How to give the chart a legend
Scaling charts
Adjusting the scale of charts dynamically
Chapter 6: Threads and Networking
Introduction
How to create multiple threads
Starting a thread
Stopping a thread
How to use queues
Passing queues among different modules
Using dialog widgets to copy files to your network
Using TCP/IP to communicate via networks
Using urlopen to read data from websites
Chapter 7: Storing Data in our MySQL Database via our GUI
Introduction
Installing and connecting to a MySQL server from Python 
Configuring the MySQL database connection
Designing the Python GUI database
Using the SQL INSERT command
Using the SQL UPDATE command
Using the SQL DELETE command
Storing and retrieving data from our MySQL database
Using the MySQL workbench
Chapter 8: Internationalization and Testing
Introduction
Displaying widget text in different languages
Changing the entire GUI language, all at once
Localizing the GUI
Preparing the GUI for internationalization
How to design a GUI in an agile fashion
Do we need to test the GUI code?
Setting debug watches
Configuring different debug output levels
Creating self-testing code using Python's __main__ section
Creating robust GUIs using unit tests
How to write unit tests using the Eclipse PyDev IDE
Chapter 9: Extending Our GUI with the wxPython Library
Introduction
Installing the wxPython library
Creating our GUI in wxPython
Quickly adding controls using wxPython
Trying to embed a main wxPython app in a main tkinter app
Trying to embed our tkinter GUI code into wxPython
Using Python to control two different GUI frameworks
Communicating between the two connected GUIs
Chapter 10: Creating Amazing 3D GUIs with PyOpenGL and PyGLet
Introduction
PyOpenGL transforms our GUI
Our GUI in 3D!
Using bitmaps to make our GUI pretty
PyGLet transforms our GUI easier than PyOpenGL
Our GUI in amazing colors
OpenGL animation
Creating a slide show using tkinter
Chapter 11: Best Practices
Introduction
Avoiding spaghetti code
Using __init__ to connect modules
Mixing fall-down and OOP coding
Using a code naming convention
When not to use OOP
How to use design patterns successfully
Avoiding complexity
GUI design using multiple notebooks

Book Details

ISBN 139781787129450
Paperback422 pages
Read More
From 4 reviews

Read More Reviews

Recommended for You

Python Machine Learning Book Cover
Python Machine Learning
$ 35.99
$ 25.20
Mastering Object-oriented Python Book Cover
Mastering Object-oriented Python
$ 26.99
$ 18.90
Modern Python Cookbook Book Cover
Modern Python Cookbook
$ 39.99
$ 28.00
Mastering Python Book Cover
Mastering Python
$ 31.99
$ 22.40
Expert Python Programming - Second Edition Book Cover
Expert Python Programming - Second Edition
$ 35.99
$ 25.20
Python Network Programming Cookbook - Second Edition Book Cover
Python Network Programming Cookbook - Second Edition
$ 39.99
$ 28.00