Master PyQt5 part3: Hand-coding a GUI

  Рет қаралды 8,318

Alan D Moore Codes

Alan D Moore Codes

4 жыл бұрын

Author Alan D Moore demonstrates how to hand-code a PyQt5 GUI using our app template.
Follow Alan at www.alandmoore.com
Purchase a copy of Mastering GUI Programming with Python here: amzn.to/3Dr8cAy
Example code for this video can be found here: github.com/alandmoore/PyQt-Vi...
Previous video in this series where we create the template: • Master PyQt5 part 1: ...
QLineEdit Documentation seen in the video: doc.qt.io/qt-5/qlineedit.html
Thanks for watching!

Пікірлер: 23
@spartacus2993
@spartacus2993 3 жыл бұрын
After stumbling around hours of other YT channels tutorials, finding this gem of a video actually explaining not just how to do things but most importantly why you would do those things really helped me understand the basics.
@91F2Z
@91F2Z Жыл бұрын
Cheap thrills: I find that using QTDesigner to create layouts, widgets, fonts, etc, then copying the pertinent sections into my code (discard the .ui file after copying), greatly speeds up coding GUI's. Also, finding out the syntax, for example hiding the password, can be found quicker by simply doing it in QTD, and then checking the ui code. Good presentation.
@Factory400
@Factory400 3 жыл бұрын
A bountiful booty indeed! This is by FAR the best presentation of PyQt5 available. It educates the viewer with 'Why' and 'How' while everyone else just says 'type this mysterious code, don't worry why it works' Now I can actually create my own GUI the way I want. Awesome.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Awesome! Glad it helped.
@thatguy6664
@thatguy6664 3 жыл бұрын
Thank you for teaching us to read the C++ docs and about using enums with the setter methods. PyQt5 makes much more sense now! Everyone: I have the book and it's fantastic. After trying to learn PyQt5 a couple times (videos, books) I am now 100% confident that by the end of the book, I'll be able to build solid, decent looking interfaces. Thanks again!
@Soljarag5
@Soljarag5 3 жыл бұрын
You are right.... I AM a smart person!
@samirasamilan2645
@samirasamilan2645 3 жыл бұрын
Great tutorial. As a result, I ordered you book. Thanks.
@Linuxovert
@Linuxovert 4 жыл бұрын
Great Job Alan, your tutorials should me taught at schools Man
@Linuxovert
@Linuxovert 4 жыл бұрын
should be*
@NphiniT
@NphiniT 3 жыл бұрын
I agree!
@alejandroayala3615
@alejandroayala3615 3 жыл бұрын
Dude you're awesome. Thank you!
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Thanks!
@rpdacosta
@rpdacosta 3 жыл бұрын
This was an awesome series of videos Alan. Well done. I just got your book, may I ask how you can also change the value of your qtw.QTableWidgetItem into a integer in stead of a string? (otherwise it's hard to sort the numbers.)
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Thanks! A QTableWidgetItem stores its contents as text by default, so one possible approach would be to subclass it to force it to only contain integers. Then use setItemPrototype on the QTableWidget to use your custom class. It's a bit complex to describe here, but if you google "subclass QTableWidgetItem" there are several tutorials out there (alas, many in C++, but that's how it goes with Qt).
@rpdacosta
@rpdacosta 3 жыл бұрын
@@alandmoorecodes3585 Ah, appreciate your response Alan, will look into subclassing QtableWidgetItem, thanks for pointing that out. Yeah, I figured this would take some work : ) That's why I believe a tut from you would be unmatched. Might fit right in your series. it's among the best out there on PyQt5 in my view, again great work and I believe I'm speaking for may when saying, thanks for taking the effort to record these and post them.
@bobbryce8674
@bobbryce8674 3 жыл бұрын
Alan - Thanks so much for the effort invested in the tutorials. I'm here to tell you it was worth it, since I just bought your GUI book! I had an error here that's probably related to my combination of PyQT5 (v5.14.1) and Python 3 (3.8). Apparently its no longer possible to apply a layout directly to the MainWindow as you'll get an error that a layout already exists. For more info, I would refer folks to this response on StackFlow stackoverflow.com/questions/37304684/qwidgetsetlayout-attempting-to-set-qlayout-on-mainwindow-which-already Thanks again Bob
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
You shouldn't apply a layout directly to a QMainWindow. You want to set a central widget instead. The QMainWindow has a layout already to accommodate the menus, status bar, and so on.
@marcowisse1
@marcowisse1 2 жыл бұрын
Thanks for a great video! I seem to have one issue though: on my mac the input fields don't expand to match the width of the buttons below; i.e. the 'Login' button protrudes beyond the edges of the input fields above...
@marcowisse1
@marcowisse1 2 жыл бұрын
For those of you who tripped over this as well: on a mac you need to set the FieldGrowthPolicy property of the layout to ExpandingFieldsGrow: add this line: layout.setFieldGrowthPolicy(qtw.QFormLayout.ExpandingFieldsGrow) to Alan's code.
@angel_machariel
@angel_machariel 3 жыл бұрын
The reason the button wasn't visible the first time is not because you didn't have a layout; That was incidental. The button didn't show because you didn't pass its parent in the constructor. I.e. QPushButton("text", self) .
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Interesting. I have never bothered explicitly adding the parent since it gets automatically re-parented by the layout object, but it does seem If the parent is specified that the widgets all appear in the upper-left corner of the widget (on top of each other). Thanks for pointing this out.
@angel_machariel
@angel_machariel 3 жыл бұрын
@@alandmoorecodes3585 Never too old to learn. I'm beginner at Python myself, coming from C# and C++.
Master PyQt5 part 4: Introduction to Signals and Slots
29:24
Alan D Moore Codes
Рет қаралды 24 М.
Master PyQt5 part 6:  QMainWindow for easy apps
27:05
Alan D Moore Codes
Рет қаралды 12 М.
Final muy increíble 😱
00:46
Juan De Dios Pantoja 2
Рет қаралды 54 МЛН
Khó thế mà cũng làm được || How did the police do that? #shorts
01:00
Became invisible for one day!  #funny #wednesday #memes
00:25
Watch Me
Рет қаралды 55 МЛН
A Simpler Way to See Results
19:17
Logan Smith
Рет қаралды 100 М.
15 Python Libraries You Should Know About
14:54
ArjanCodes
Рет қаралды 372 М.
Master PyQt5 part 5: Moving data between windows
18:46
Alan D Moore Codes
Рет қаралды 20 М.
QtDesigner and PyQt5:  The right and wrong way to use them together
37:16
Alan D Moore Codes
Рет қаралды 107 М.
Master PyQt5 part 10: Make responsive GUIs with Threads
33:35
Alan D Moore Codes
Рет қаралды 19 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 795 М.
Мой инст: denkiselef. Как забрать телефон через экран.
0:54
Choose a phone for your mom
0:20
ChooseGift
Рет қаралды 6 МЛН
Самый дорогой кабель Apple
0:37
Romancev768
Рет қаралды 337 М.
Опять съемные крышки в смартфонах? #cmf
0:50