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 now! 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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering GUI Programming with Python

You're reading from   Mastering GUI Programming with Python Develop impressive cross-platform GUI applications with PyQt

Arrow left icon
Product type Paperback
Published in May 2019
Publisher Packt
ISBN-13 9781789612905
Length 542 pages
Edition 1st Edition
Languages
Tools
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 (24) Chapters Close

Preface 1. Section 1: Deep Dive into PyQt FREE CHAPTER
2. Getting Started with PyQt 3. Building Forms with QtWidgets 4. Handling Events with Signals and Slots 5. Building Applications with QMainWindow 6. Creating Data Interfaces with Model-View Classes 7. Styling Qt Applications 8. Section 2: Working with External Resources
9. Working with Audio-Visual Using QtMultimedia 10. Networking with QtNetwork 11. Exploring SQL with Qt SQL 12. Section 3: Unraveling Advanced Qt Implementations
13. Multithreading with QTimer and QThread 14. Creating Rich Text with QTextDocument 15. Creating 2D Graphics with QPainter 16. Creating 3D Graphics with QtOpenGL 17. Embedding Data Plots with QtCharts 18. PyQt Raspberry Pi 19. Web Browsing with QtWebEngine 20. Preparing Your Software for Distribution 21. Answers to Questions 22. Upgrading Raspbian 9 to Raspbian 10
23. Other Books You May Enjoy

Chapter 6

  1. You are preparing to distribute your text editor application and want to ensure that the user is given a monospaced font by default, no matter what platform they use. What two methods can you use to accomplish this?

The first way is to set the styleHint of the default font to QtGui.QFont.Monospace. The second is to find an appropriately-licensed, monospaced font, bundle it in a Qt Resource file, and set the font to your bundled font.

  1. As closely as possible, try to mimic the following text using QFont:

The code is as follows:

   font = qtg.QFont('Times', 32, qtg.QFont.Bold)
font.setUnderline(True)
font.setOverline(True)
font.setCapitalization(qtg.QFont.SmallCaps)
  1. Can you explain the difference between QImage, QPixmap, and QIcon?

QPixmap and QImage both represent a single image, but QPixmap is optimized for display, while QImage is optimized for...

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 €18.99/month. Cancel anytime