Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Python GUI Programming with Tkinter

You're reading from   Python GUI Programming with Tkinter Develop responsive and powerful GUI applications with Tkinter

Arrow left icon
Product type Paperback
Published in May 2018
Publisher Packt
ISBN-13 9781788835886
Length 452 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
 D. Moore D. Moore
Author Profile Icon D. Moore
D. Moore
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
1. Introduction to Tkinter FREE CHAPTER 2. Designing GUI Applications with Tkinter 3. Creating Basic Forms with Tkinter and ttk Widgets 4. Reducing User Error with Validation and Automation 5. Planning for the Expansion of Our Application 6. Creating Menus with Menu and Tkinter Dialogs 7. Navigating Records with Treeview 8. Improving the Look with Styles and Themes 9. Maintaining Cross-Platform Compatibility 10. Creating Automated Tests with unittest 11. Improving Data Storage with SQL 12. Connecting to the Cloud 13. Asynchronous Programming with Thread and Queue 14. Visualizing Data Using the Canvas Widget 15. Packaging with setuptools and cx_Freeze 1. Other Books You May Enjoy Index

Making our settings work


While the file saving works, the settings do not. The settings menu items should work as expected, remaining checked or unchecked, but they don't yet change the behavior of the data entry form. Let's make this work.

Recall that both autofill features are implemented in the DataRecordForm class's reset() method. To use our new settings, we need to give our form access to the settings dictionary by performing the following steps:

  1. Open views.py and update the DataRecordForm.__init__() method as follows:
    def __init__(self, parent, fields, settings, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
self.settings = settings
  1. We've added an additional positional argument, settings, and then set that to self.settings so that all of the methods in the class can access it. Now, look at the reset() method; currently, the date autofill code is as follows:
        current_date = datetime.today().strftime('%Y-%m-%d')
        self.inputs['Date'].set(current_date...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images