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
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python GUI Programming with Tkinter, 2nd edition

You're reading from   Python GUI Programming with Tkinter, 2nd edition Design and build functional and user-friendly GUI applications

Arrow left icon
Product type Paperback
Published in Oct 2021
Publisher Packt
ISBN-13 9781801815925
Length 664 pages
Edition 2nd Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Alan D. Moore Alan D. Moore
Author Profile Icon Alan D. Moore
Alan D. Moore
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Introduction to Tkinter 2. Designing GUI Applications FREE CHAPTER 3. Creating Basic Forms with Tkinter and Ttk Widgets 4. Organizing Our Code with Classes 5. Reducing User Error with Validation and Automation 6. Planning for the Expansion of Our Application 7. Creating Menus with Menu and Tkinter Dialogs 8. Navigating Records with Treeview and Notebook 9. Improving the Look with Styles and Themes 10. Maintaining Cross-Platform Compatibility 11. Creating Automated Tests with unittest 12. Improving Data Storage with SQL 13. Connecting to the Cloud 14. Asynchronous Programming with Thread and Queue 15. Visualizing Data Using the Canvas Widget 16. Packaging with setuptools and cxFreeze 17. A: A Quick Primer on reStructuredText 18. B: A Quick SQL Tutorial 19. Other Books You May Enjoy
20. Index
Appendices

SQL concepts

SQL databases are made up of tables. A table is something like a CSV or spreadsheet file, in that it has rows representing individual items and columns representing data values associated with each item. A SQL table has some important differences from a spreadsheet, though:

  • First, each column in the table is assigned a data type, which is strictly enforced. Just as Python will produce an error when you try to convert "abcd" to an int or 0.03 into a date, a SQL database will return an error if you try to insert letters into a numeric column or decimal values into a date column. SQL databases typically support basic data types like text, numbers, dates and times, Boolean values, and binary data; in addition, some implementations have specialized data types for things like IP addresses, JSON data, currency, or images.
  • SQL tables can also have constraints, which further enforce the validity of data inserted into the table. For example, a column can be given a unique constraint, which prevents two rows from having the same value in that column, or a not null constraint, which means that every row must have a value.

SQL databases commonly contain many tables, and these can be joined together to represent much more complicated data structures. By breaking data into multiple linked tables, we can store it in a way that is much more efficient and resilient than a two-dimensional plaintext CSV file.

Syntax differences from Python

If you've only ever programmed in Python, SQL may feel odd at first, as the rules and syntax are very different. We'll be going over the individual commands and keywords, but here are some general differences from Python:

  • SQL is (mostly) case-insensitive: Although it's conventional for readability purposes to type the SQL keywords in all caps, most SQL implementations are not case-sensitive. There are a few small exceptions here and there, but, for the most part, you can type SQL in whatever case is easiest for you.
  • Whitespace is not significant: In Python, new lines and indentation can change the meaning of a piece of code. In SQL, whitespace is not significant and statements are terminated with a semicolon. Indents and new lines in a query are only there for readability.
  • SQL is declarative: Python could be described as an imperative programming language: we tell Python what we want it to do by telling it how to do it. SQL is more of a declarative language: we describe what we want done, and the SQL engine figures out how to do it.

We'll encounter additional syntax differences as we look at specific SQL code examples.

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 $19.99/month. Cancel anytime
Banner background image