Introduction to GUIs in Python with PyQt5

  Рет қаралды 83,882

Clear Code

Clear Code

Күн бұрын

A video about making a basic calculator gui with Python and PyQt5. I will cover the basics of GUIs in general how PyQt works in particular and how to create a layout and the logic of a calculator. Ideally, you should have some knowledge about object oriented programming and lambdas.

Пікірлер: 85
@forcerous_5127
@forcerous_5127 3 жыл бұрын
HOW TF IS THIS DUDE NOT KNOWN? THIS DUDE HAS AMAZING TRANSITION ANIMATIONS LIKE WTF???? DUDE. THIS TUTORIAL IS AMAZING. AND VERY VERY CLEAR.
@karthigeyanj7508
@karthigeyanj7508 3 жыл бұрын
bruh its clear cause its clear code
@hampten23
@hampten23 2 жыл бұрын
Why are the letters so small. I can't read
@lewyathan
@lewyathan 2 жыл бұрын
A FREAKING LEGENDDD
@KushG420
@KushG420 3 жыл бұрын
Finally after a long time, came across one of those --Criminally underrated channels
@thingsiplay
@thingsiplay 4 жыл бұрын
I just watched Alan's tutorials and now yours are the next. It makes so perfect sense that you take his approach of abbreviating and reference to him. The world makes so much sense now, everything is connected!!! Seriously, this is a very good tutorial and probably a bit easier to understand.
@aimenbarigoudz
@aimenbarigoudz 3 жыл бұрын
Your tutorials are so good, best ive found, so clear and just fast enough for beginners and amateurs and you actually explain how everything works in detail
@Milano606
@Milano606 3 жыл бұрын
Awesome tutorial. Really clear. Not too basic. Explains the necessary concepts like an expert. It was just what I was looking for to get a better grasp on this framework, thanks.
@fashizlecartman
@fashizlecartman 3 жыл бұрын
Thank you sir, you saved me 4 hours of stack overflow today. With love from America. Amazing videos. Subscribed.
@notsobob
@notsobob 3 жыл бұрын
really good clear description, and slick visuals! thanks
@sauceontoes3457
@sauceontoes3457 3 жыл бұрын
i sacrificed my eyes for this jokes aside, this tutorial is very good how tf is this underrated
@NeilLTayler
@NeilLTayler 3 жыл бұрын
This was very well made, thank you for this.
@FernandoOrtega10
@FernandoOrtega10 3 жыл бұрын
Awesome tutorial!! I'm actually curious, what do you use for the presentation itself? your graphics make the explanations very clear, and your IDE looks nice and clean (I think it's a customized Sumblime, isn't it?) kudos for the effort in making this very presentable!
@CraigHollabaugh
@CraigHollabaugh 3 жыл бұрын
Hey thanks, just what I needed to get started.
@marcus.the.younger
@marcus.the.younger 3 жыл бұрын
Wonderful explaination You sir have earned a subscriber
@ankitcaring
@ankitcaring 11 ай бұрын
Thanks for making such a concise video. Starting from what's the prerequisite and explaining with animation. Exactly the thing I need to hear.👍👍 p.s:- been done some editing , I know this kind of tutorial required alot of effort to create then directly just coding on a computer screen.
@NewBlueType
@NewBlueType 2 жыл бұрын
Great tutorial by the way, thanks!
@stefanb.2575
@stefanb.2575 3 жыл бұрын
Came to this video because i finally found someone with a good design for their app. Watched 10secs „and this is what we are going to build“ 😭 (tutorial might still be good for the programming part)
@cinquecento1985
@cinquecento1985 2 жыл бұрын
thank you. finally its a little more clear.
@mileswhitehead684
@mileswhitehead684 10 күн бұрын
I really recommend you guys try and figure out how to fix all of the bugs! It really tested my problem solving skills. The main ones are 1. Enter crashes the program 2. Divide by zero crashes the program 3. Inputting multiple "*" or "/" without a number in front or pressing enter with "*" or "/" at the start or end crashes the program Remember to implement your solutions while still allowing the minus sign to be put before all numbers!
@adrianrdzaldrete7731
@adrianrdzaldrete7731 4 жыл бұрын
19:56 Nice.
@sskybluezen
@sskybluezen 3 жыл бұрын
You have potential to get 1 million subs KEEP GOING FORWARD!!!!!!!!!!!!
@dub27step
@dub27step 3 жыл бұрын
You're a legend sir!
@monikaguttler3452
@monikaguttler3452 3 жыл бұрын
Super Tutorial, danke!
@navpreetpawar6877
@navpreetpawar6877 3 жыл бұрын
Explained very nicely! Thanks a lot. Question - wouldn't using the qtDesigner be better, instead of typing? I have used qt with C++ only, and curious to know, why almost all python projects( that I have come across) don't use a qt ui file.
@alessandrocasol9499
@alessandrocasol9499 3 жыл бұрын
Disliked the misleading thumbnail but you're a good teacher and is always great to have someone who share's knowledge for free. Just use a thumbnail with the project you're teaching please
@hfe1833
@hfe1833 2 жыл бұрын
This video rate should be more than Google play 5 star
@BenjaminDelespierre
@BenjaminDelespierre 3 жыл бұрын
Very good video. If you’re going to use eval why not simply concatenate all pressed button labels in the evaluated string directly?
@Mega-gb1yk
@Mega-gb1yk 3 жыл бұрын
Esse é o video mais perfeito que ja vi
@LOOPNEWSBR
@LOOPNEWSBR 3 жыл бұрын
Porque?
@Mega-gb1yk
@Mega-gb1yk 3 жыл бұрын
Aprendi uns bglh q eu n tanva conseguindo pegar ai
@ssa5852
@ssa5852 3 жыл бұрын
Thank you for this video. What theme you using in this video?
@luismiguelnevesgoncalves3702
@luismiguelnevesgoncalves3702 4 жыл бұрын
Hi! I'm wondering what software are you using. I've tried Python 3 (Idle) but it doesn't look as beautiful as yours. Cheers and keep up the good work!
@ClearCode
@ClearCode 4 жыл бұрын
Hey, I am using the sublime code editor and hide all the ui elements (which is quite easy to do) and use a bright theme, I believe for this video the theme was called ayu.
@alekjanowski9847
@alekjanowski9847 3 жыл бұрын
@@ClearCode Hello sorry for bothering you but I have a problem with the Lambdas (I'm using pycharm and wanted to know if you downloaded something extra?)
@ememmeme8722
@ememmeme8722 3 жыл бұрын
how can i double like this video?
@tuanphamcong3583
@tuanphamcong3583 3 жыл бұрын
Can you help me Sir? Instead of creating a QPushButton from QtWidgets class, I want to create QLabel object to store image, and container=QtWidgets.QLabel(). The addWidget stuff stays the same in the video. Can it run?
@sashakopiika
@sashakopiika 4 жыл бұрын
I can't find the book that you've recommended in this video. Could you send me a link to this book or explain how to find it. Btw why didn't you use qtdesigner? PS actually I find this video really helpful and appreciate that you've done
@ClearCode
@ClearCode 4 жыл бұрын
Hey, glad you liked the video and here is the book: www.packtpub.com/gb/application-development/mastering-gui-programming-python It isn't exactly cheap but you can't find lots of free copies online, but you didn't hear that from me! :) And I didn't use qtdesigner because the layout was pretty straightforward anyway and the video was already getting really long.
@prasoonjha1816
@prasoonjha1816 3 жыл бұрын
Please make a video on how can we integrate PyQt5 into Pygame to make our game more interactive (if it is possible).
@nirajchowdhary7372
@nirajchowdhary7372 3 жыл бұрын
You further made the video interesting by choosing numbers as '4', '2', '0' :p
@SHONNER
@SHONNER 3 жыл бұрын
I've only used Qt Designer to do Python GUIs.
@kwizerafrank4978
@kwizerafrank4978 2 жыл бұрын
Thanks man
@lens3973
@lens3973 3 жыл бұрын
You should make the entire code available to look over in a pastebin or something. Sucks to have to skim through the video just to find one line.
@pablo14539
@pablo14539 3 жыл бұрын
Thankyou bro! but a have this problem in my code, see: btn8 = qtw.QPushButton('8', clicked = lambda: self.num_press('8')) AttributeError: 'MainWindows' object has no attribute 'num_press' Can you help-me?
@joeyhodge2404
@joeyhodge2404 3 жыл бұрын
I’m having trouble with lambdas. They generate syntax errors when used as they are here. I’m on python 3.8.3. I use ‘partial’ instead on tkinter but that doesn’t seem to work with pyqt5. I’m stuck without a workaround.
@ClearCode
@ClearCode 3 жыл бұрын
you can just use regular functions. Just make sure that when you connect it to the button you don't call the function (so clicked = button_function instead of clicked = button_function() ). Quite sure that tkinter doesn't need lambdas either, it just happens to be much more concise than writing a dedicated function for every single button.
@nawaytes24
@nawaytes24 3 жыл бұрын
I have finished the layout, but can't call the 'clicked' function
@djdan8777
@djdan8777 3 жыл бұрын
Give me more stuff like this! :D
@ClearCode
@ClearCode 3 жыл бұрын
I am actually planning on making more pyqt tutorials, any specific topic you'd be interested in?
@djdan8777
@djdan8777 3 жыл бұрын
​@@ClearCode Touch events would be great (sliding, rotating, zooming etc) :D Beside that maybe you've tried to combine it with Panda3D or to make some stuff with Qt3D? (and make it working with touch events - I'm trying to make TIN mesh viewer). And generally creating some more complex apps. After that deploying app on the PC and Android would be the icing on the cake :D There is no one on the Internet who make tutorials so clear and in such style as you! So I think that people will love it! :D Of course I will also very appriciate some basics from PyQt5/PySide2, but those things above would make you Qt+Python star on the KZbin :D
@MianAffanAli
@MianAffanAli 3 жыл бұрын
which code editor you are using in this video?
@ClearCode
@ClearCode 3 жыл бұрын
hey, it is the sublime code editor
@gurnkerk3826
@gurnkerk3826 3 жыл бұрын
Nice video! One question tho… Are u german cuz I think I heard it out but I am not sure and in school I struggle the most with listening tasks so would be nice if you could answer me!
@qqlez
@qqlez 2 жыл бұрын
# I got buttons 0-9 done in 4 cheeky lines: for x in range(9): y = 2 if x == 0 else y+1 if x % 3 == 0 else y container.layout().addWidget(qtw.QPushButton(str(9-x)), y, x-(y-2)*3, 1, 1) container.layout().addWidget(qtw.QPushButton('0'), 6, 0, 1, 4)
@user-tu8xx6em8h
@user-tu8xx6em8h 4 жыл бұрын
Hey, please help me!: terminal AttributeError: module 'PyQt5.QtWidgets' has no attribute 'QtWidgets'
@ClearCode
@ClearCode 4 жыл бұрын
Hey, how are you importing the PyQt5 modules?
@cesandr
@cesandr 4 жыл бұрын
Hey had the same problem and fixed it by initializing the MainWindow class not with QtWidgets but with QWidget
@KanikaRaheja
@KanikaRaheja 3 жыл бұрын
getting the same error .please help!
@RohanKumar-zd3pc
@RohanKumar-zd3pc 3 жыл бұрын
@@KanikaRaheja Well well well, Install pyqt5 first
@matthiasdunkel9782
@matthiasdunkel9782 3 жыл бұрын
Will there be another part?
@dogesh828
@dogesh828 3 жыл бұрын
Can anyone explain me why there is error if i use this ---- btn_9 = qtw.QPushButton('9', clicked=self.num_press('9')) ---- instead of this ---- btn_9 = qtw.QPushButton('9', clicked=lambda: self.num_press('9')) ----
@kvrule
@kvrule 3 жыл бұрын
clicked expects a function to be passed in. When you pass self.num_press('9') your actually calling that function and therefore passing the result of that function which is not of type function, which is why it doesn't work. The lambda expression on the other hand, returns a function which in this case happens to be a function that does the same thing as self.num_press('9'). This means the lambda expression is passing the correct type, which is why it works.
@NewBlueType
@NewBlueType 2 жыл бұрын
Couldn't you create a function that returns a list of the buttons 0-9 instead of manually writing each one? for i in range(10): btn_list[i].append(qtw.QtPushButton(string(i))
@qqlez
@qqlez 2 жыл бұрын
did u get this to work?
@drewdrew1468
@drewdrew1468 2 жыл бұрын
I kept getting syntax errors when I tried to type "Lambda" instead I had to use lowercase "lambda" to get it to work.
@airocety4391
@airocety4391 4 жыл бұрын
Is it better than Tkinter, which one is more powerful?
@ClearCode
@ClearCode 4 жыл бұрын
Hey, I personally never used tkinter much, so I'm afraid my opinion wouldn't be all that relevant. Both basically just give you access to different gui elements, and you can make complex apps in both. But from what I heard, which is not a great metric, pyqt is more convenient to use and easier to maintain for larger projects.
@airocety4391
@airocety4391 4 жыл бұрын
@@ClearCode Thank you
@marcus.the.younger
@marcus.the.younger 3 жыл бұрын
@@airocety4391 I am here after learning Tkinter... With tkinter's ttk , you can create a gui as beautiful as PyQt5 The choice is yours
@kwccoin3115
@kwccoin3115 7 ай бұрын
any github? BTW 25:17 the result_string is actually of number type and should be called result_num
@srikar8718
@srikar8718 3 жыл бұрын
hello bro how to do this through pyqt creator
@peterbreis5407
@peterbreis5407 2 жыл бұрын
Thank you very much. You are very clear and organised and the information is very useful. Just one thing. I know English is your second language but you speak it very well, however your presentation is full of distracting typos, which meant I was not fully focusing on the lessons.
@jwnigel
@jwnigel 2 жыл бұрын
I didn't notice any... Do you mean the object and function names?
@SP-is5pz
@SP-is5pz 2 жыл бұрын
the calculator just crashes after entering a number or clicking any of the buttons but you can probably figure out how to fix it ur self
@amanapatel2366
@amanapatel2366 2 жыл бұрын
You should add source code for better understanding
@SorenDeveloppement
@SorenDeveloppement 2 жыл бұрын
What iss your IDE
@AlexJaeger716
@AlexJaeger716 2 жыл бұрын
too many ads. can't skip around without running into an ad
@gavingotback
@gavingotback 3 жыл бұрын
tkinter is so much easier tho :,(
@nictanghe98
@nictanghe98 3 жыл бұрын
THe thumbnail wqs verry deceiving.
@nictanghe98
@nictanghe98 3 жыл бұрын
How to make it look good ?
@FernandoOrtega10
@FernandoOrtega10 3 жыл бұрын
It was! he probably just applied a stylesheet afterwards, you can customized the app colours that way.
@mattshu
@mattshu 3 жыл бұрын
What an awkward number pad format...
@julianandresgomezgomez7264
@julianandresgomezgomez7264 3 жыл бұрын
DISLIKE! THE RESULT IS VERY DIFFERENT FROM THE VIDEO PICTURE
Understanding decorators [Python tutorial]
42:31
Clear Code
Рет қаралды 25 М.
PyQt6 - The Ultimate GUI Toolkit for Python Developers in 2023
2:03:44
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 21 МЛН
Learning pygame by creating Snake [python tutorial]
2:05:00
Clear Code
Рет қаралды 345 М.
QtDesigner and PyQt5:  The right and wrong way to use them together
37:16
Alan D Moore Codes
Рет қаралды 107 М.
PyQt6 Course For Beginners [Python GUI Framework PyQt ]
3:09:20
Parwiz Forogh
Рет қаралды 161 М.
Image Manipulation in Python [ A complete guide to Pillow ]
2:17:18
4 Python GUI Projects with PyQt5 for COMPLETE beginners
2:46:20
Code First with Hala
Рет қаралды 28 М.
Creating PyQt Layouts for GUI Python Applications
13:56
Real Python
Рет қаралды 29 М.
Rust and RAII Memory Management - Computerphile
24:22
Computerphile
Рет қаралды 219 М.