Font Widget - PyQt with Python GUI Programming tutorial 11
Key Takeaways
Uses the font widget in a PyQt GUI application
Full Transcript
what is going on everybody Welcome To Part 11 of our python with pqt tutorial video series in this video we're going to be talking about the font picker built in to pqt so this is just one of the many widgets that will make your life way easier so uh let's go ahead and we're going to add this to the homepage and we're going to put it in the toolbar so after we add add here basically we're going to do this let's move this down and then we're going to come here and basically we'll keep the same toolbar actually I'll show you uh something interesting when we change this so let's just copy all of that and we'll paste and we're going to say instead we're going to call this font Choice and then we're going to say so this is font Choice font Choice Self font choice and um font here and then here this will be self up font Choice like that I'm probably missing something here besides this um so this one if you recall this one had a icon a name and uh obviously self but instead what we're going to do is we're going to get rid of the icon part and then and we're going to change this to uh font just like that so you have font Choice font Choice that's good self. font choice just making sure I didn't mess anything up self. toolbar uh so what we could do is we could either get rid of this toolbar like this and run that so let's go well it's going to get angry at us because we haven't defined this method yet so let's define that method first so we're going to come down here Define font choice and font choice we just need to pass self and what we're going to do is we run basically this is dialogue so we're going to say basically font and valid so this returns two uh returns two variables basically so it's going to be QT gooey. Q font dialog. getet font so this is a font dialogue and we want to go ahead and get the font so it's going to pop up both and then then we're just going to ask if valid what do we want to do we're going to say self. style choice. set font font okay so that's going to what it's going to do is it's going to uh if valid self. style Choice set font f um that should be up style Choice here and it will be basically here so when this goes um to create that label that we created in the previous video what it's going to do is it's going to use the font that we choose um so that font will change and you'll see what I mean in in a bit when we change it so now that we've got font Choice uh coming back up to the very very top here we've got self. toolbar and all that let's go ahead and run this really quick and we can see Okay so we've got uh some choices here and this is all part of the same toolbar so if we moved it over here font and the little baby come with us whereas what if what if um what if we close this and instead we said self. toolbar and we add kind of like this other you know font what happens when we add that well now they're kind of their own little toolbar so I can move the little baby over here but font still stays there and I can move font down you know I can even actually move it over here right there okay so depending on what you want you can either make a new toolbar or you can keep it a part of the original toolbar it doesn't really matter I think it's wise to go ahead and keep the old tool tool bar but you can do what you want so anyways whenever you click on it up will pop the font picker and we can choose all kinds of font here let's choose uh let's Cho something interesting can we choose wingdings we sure can bold that and put it to 24 boam so now we've got this massive windows but it's a little too big to fit in the little Dimensions that we specified so let's do this so anyway uh you can run through this and keep changing the font of this label here it doesn't really matter but this is just a quick example of how you can actually change font and what's cool is that uh you can oh you can pick all kinds of fonts now can't we awesome ah it didn't let us anyway um so now you have this awesome font picker and like the sometimes like these it may or may not be useful to you it depends on what your application is of course uh but it's certainly nice to have a font picker at your disposal so this is the font picker is really just one of the major uh things that PQ is going to give to you but there are actually some other things that we're going to be talking about really quickly here there's going to be the Color Picker so it's like a color wheel that you can choose from also there is like a nice um kind of editor widget calendar widget and I'm trying to think of anything else that we're going to be showing um oh and a file picker so it's it's a way that you can find your files open them close them save them whatever um so stuff like that so anyways that's what we're going to be talking about in the coming vide so stay tuned for that if you have any questions or comments up to this point please feel free to leave them below otherwise as always thanks for watching thanks for all the support and subscriptions and until next time
Original Description
In this PyQT4 GUI application development tutorial, we cover the font widget, which can be used for changing fonts and sizes.
sample code: http://pythonprogramming.net
http://hkinsley.com
https://twitter.com/sentdex
http://sentdex.com
http://seaofbtc.com
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from sentdex · sentdex · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Matplotlib Python Tutorial Part 1: Basics and your first Graph!
sentdex
Python Encryption Tutorial with PyCrypto
sentdex
Python's Logging Function
sentdex
wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
sentdex
wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
sentdex
wxPython Programming Tutorial 3: Menu Bar and Menu Button
sentdex
wxPython Programming Tutorial 4: Panels
sentdex
wxPython Programming Tutorial 5: User Input Saved To Variables
sentdex
wxPython Programming Tutorial 6: Multiple Choice Input
sentdex
wxPython Programming Tutorial 7: Adding Static Text and Colors
sentdex
wxPython Programming Tutorial 8: Custom Button Images
sentdex
wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
sentdex
Basic PHP Tutorial 13: Multi-dimensional Array
sentdex
Basic PHP Tutorial 15: Functions and Global Variables
sentdex
Basic PHP Tutorial 12: Associative Array
sentdex
Basic PHP Tutorial 14: Foreach loop
sentdex
Basic PHP Tutorial 16: Include and Require
sentdex
Basic PHP Tutorial 7: Assignment, comparison and Logical operators
sentdex
Basic PHP Tutorial 4: Variables and Comments
sentdex
Basic PHP Tutorial 11: Arrays part 1, basic array
sentdex
Basic PHP Tutorial 6: If else and else if conditionals cont'd
sentdex
Basic PHP Tutorial 1: Intro to PHP
sentdex
Basic PHP Tutorial 3: HTML with PHP
sentdex
Basic PHP Tutorial 9: While Loop
sentdex
Basic PHP Tutorial 10: Switch Statement
sentdex
Basic PHP Tutorial 2: Print and Echo
sentdex
Basic PHP Tutorial 5: If else and else if conditional statements
sentdex
Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
sentdex
Basic PHP Tutorial 17: User Input Form Example / String Manipulation
sentdex
Basic PHP Tutorial 18: HTML Entities and forms cont'd
sentdex
Basic PHP Tutorial 19: Finding words in strings
sentdex
Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
sentdex
Basic PHP Programming Tutorial 22: Hashing part 2: salting
sentdex
Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
sentdex
Basic PHP Programming Tutorial 21: MD5 Hashing For Security
sentdex
Basic PHP Programming Tutorial 24: String similarity
sentdex
Basic PHP Programming Tutorial 25: Time and Time stamps
sentdex
Basic PHP Programming Tutorial 26: Die and Exit
sentdex
Basic PHP Programming Tutorial 27: MySQL Databases Part 1
sentdex
Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
sentdex
Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
sentdex
Basic PHP Programming Tutorial 30: MySQL database in Use
sentdex
Django Tutorial Web Development with Python Part 1: Installing Django
sentdex
Python Tutorial: File Deletion and Folder Deletion / directory deletion
sentdex
Python Tutorial: How to Rename Files and Move Files with Python
sentdex
3D Graphs in Matplotlib for Python: Basic 3D Line
sentdex
3D Plotting in Matplotlib for Python: 3D Scatter Plot
sentdex
3D Charts in Matplotlib for Python: Multiple datasets scatter plot
sentdex
Sikuli Tutorial 1: Visually programming in python!
sentdex
Sikuli Tutorial 2: Program visually in python!
sentdex
Sikuli Tutorial 3: Program visually in python!
sentdex
3D Bar Charts in Python and Matplotlib
sentdex
3D Plane wire frame Graph Chart in Python
sentdex
Raspberry Pi Part 1 Introduction
sentdex
Raspberry Pi Part 8: First Download and Update! (Firmware)
sentdex
Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
sentdex
Raspberry Pi Part 11: Remote Desktop
sentdex
Twitter Analysis: How to rank a user's influence
sentdex
GPIO Tutorial for Pi Part 2 - Programming the GPIO
sentdex
GPIO Tutorial for Raspberry Pi Part 1 - Setting up
sentdex
🎓
Tutor Explanation
DeepCamp AI