QtDesigner and PyQt5: The right and wrong way to use them together

  Рет қаралды 107,394

Alan D Moore Codes

Alan D Moore Codes

Күн бұрын

Author Alan D Moore describes some common pitfalls of using QtDesigner with PyQt5, and the proper way to combine the two to build GUI applications.
Follow Alan at www.alandmoore.com
Purchase a copy of Mastering GUI Programming with Python here: amzn.to/3Dr8cAy
Find some example code from the book covering the use of PyQt5 with QtDesigner at github: github.com/PacktPublishing/Ma...
Example code for this video can be found here: github.com/alandmoore/PyQt-Vi...
Thanks for watching!

Пікірлер: 185
@vealen
@vealen 2 жыл бұрын
2022 and still the best video here on youtube about this topic! Golden tips. There a lot of content about PyQt5, but they are not so usefull as this video, because it clears so much and explains how does it work.
@N.A._McBee
@N.A._McBee 3 жыл бұрын
Extremely valuable advice, exactly what I was looking for! Thanks a lot!
@outtascope
@outtascope 2 жыл бұрын
Excellent video, thank you! 30 minutes to remember everything I've forgotten over the last 4 years. 👍👍👍
@skymoo1927
@skymoo1927 3 жыл бұрын
You saved my life on my senior design project. Couldn't figure out why none of my buttons would connect and now it all makes sense!
@potatoking5602
@potatoking5602 3 жыл бұрын
Thought this was obvious enough, seems like it wasn't, thanks for doing this labor for all of those who didn't think they would loose their changes
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
This is one of those mistakes I ran into far too often and just had to make a video, because explaining it again and again on reddit or other forums was too tedious. To be fair, a lot of people just aren't thinking they're going to go back and re-edit the layout in Designer, they just want to get something going. Unfortunately the demo code that pyuic5 tacks onto the bottom steers them in the wrong direction about how to actually use the class.
@TheDrewCrawford
@TheDrewCrawford 3 жыл бұрын
I found your video after doing 80% of the wrong steps you went over here. Thank you for explaining this so clearly. I'll be getting your book for sure.
@longhaulblue1145
@longhaulblue1145 3 жыл бұрын
Very useful. My past GUI apps have been browser based but I have to do one now with Qt. Tried out Designer and was undecided about it until I watched you video. Your last comments were spot on. Thanks!
@ianboard3555
@ianboard3555 3 жыл бұрын
This is truly excellent and answers a bunch of questions I had.
@cheeko8080
@cheeko8080 2 жыл бұрын
This was SO helpful! Thank you for creating this!
@nagaki9294
@nagaki9294 3 жыл бұрын
A lot of extremely useful advice is in this video. Thank you so much!!!!
@LadyPary8
@LadyPary8 3 жыл бұрын
Hi! Your channel saved me! I’ve been making this exact mistake in my project and suffering from all these errors and not understanding whats going on! found your video three days before deadline, I fixed everything thanks to you. I hope you’re safe and happy.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Thank you, doing well here. Glad this video helped.
@zskater1234
@zskater1234 3 жыл бұрын
I'm so glad that I've found this video. You're THE man!
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Thanks!
@EricYarger
@EricYarger Жыл бұрын
Thank you for the clarification on this!! I handed coded a PyQt5 GUI for a project at work and was just investigating using the Designer (but not wanting to really re-do my code). Having wrote the GUI by hand, I can see the value in not over complicating it with Designer...I'm served better by just understanding PyQt5 as a whole. Thank you again for the clear and concise video, and your professional advice!! 2023....still makes sense. lol
@esphilee
@esphilee 4 жыл бұрын
I just discovered a gem. Thank you.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Thank you!
@ali-kadar
@ali-kadar 3 жыл бұрын
That is a very good piece of advice for people who are beginning to build GUI's in Python using Qt. Thanks very much.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Glad it was helpful!
@johnnytoobad7785
@johnnytoobad7785 2 жыл бұрын
This was excellent..I was avoiding using the "designer" since it created "read only" code and I wasn't sure how to incorporate it. Now that I know it creates "an inheritable object"..that's all changed.
@geminii716
@geminii716 3 жыл бұрын
Thank you very much! You explained exactly what I wanted to know.
@juanignaciocansillieri2413
@juanignaciocansillieri2413 3 жыл бұрын
Amazing! All your explanation was clear. Thanks to share your knowledge.
@narbus7308
@narbus7308 Жыл бұрын
thank you very much, this video is extremely helpful, I'm here because an user from stackoverflow recommended me to watch your video.
@leonsonnenschein8
@leonsonnenschein8 Жыл бұрын
Thank you so much for all of these videos! you saved me so much time ❤
@VectorLP
@VectorLP 2 жыл бұрын
this is the video i needed to see, thank you very much
@_iamraj
@_iamraj 3 жыл бұрын
Thanks for the wonderful video.... This really saved me a lot to trips to the documentation and google...
@mebratuteklehaimanot9229
@mebratuteklehaimanot9229 3 жыл бұрын
Thank you so much Alan D Moore
@jonathanbradford2322
@jonathanbradford2322 11 ай бұрын
Excellent video! Great how the wrong steps are shown. I'm buying the book.
@youssefmebarki9979
@youssefmebarki9979 3 жыл бұрын
Great video. Thank you. I am going to check you book.
@syedasimhussainrizvi2165
@syedasimhussainrizvi2165 2 жыл бұрын
Exactly what I needed to know!
@isidrodeleon673
@isidrodeleon673 4 ай бұрын
Excellent video. I add that the UI compiler can be configured in the IDE (in my case I use PyCharm) as an "external tool", so that, after modifying and saving the .ui file with QtDesigner, it is no longer necessary to manually compile the file .ui (with just three clicks inside PyCharm, and the updated code appears).
@MrMrDbjock
@MrMrDbjock 4 жыл бұрын
Thank you for teaching the sanity, and correct "python" way. I have been watching many vids and they either change the generated code which I know is wrong since all those changes would have to be done again, or the import the ui, which makes the app way slower at start up. I was struggling getting my mind wrapped around using these classes and you made it clear :-). Your book is now on it's way to my home. Thank you again for the clarity.
@alandmoorecodes3585
@alandmoorecodes3585 4 жыл бұрын
Glad I can help!
@KeeganDent
@KeeganDent 2 жыл бұрын
My bigger problem with loading the ui dynamically with PyQt5.uic is that your editor cannot give you any context-aware code completion, and you instead have to keep Qt Designer open and read it like a blueprint, also going to the Qt documentation every time you forget the name of a relevant method. Just a terrible workflow when you could instead have a static file for your editor to provide clues on.
@CKoshnick
@CKoshnick 2 жыл бұрын
I was 10 seconds away from doing everything the wrong way. Thank you for demonstrating this!
@josephmejia9520
@josephmejia9520 2 жыл бұрын
This was extremly helpful for me thank you sir! God bless!
@srini3828
@srini3828 3 жыл бұрын
Excellent one, very well explained, Thank you.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
You are welcome!
@sistemamarco
@sistemamarco 3 жыл бұрын
Beautiful explanation. Thanks
@tfxobrien
@tfxobrien 2 жыл бұрын
Thank you. I bought your book based on this excellent video.
@alandmoorecodes3585
@alandmoorecodes3585 2 жыл бұрын
Thanks!
@hosseinroosta5154
@hosseinroosta5154 3 жыл бұрын
thats extactly what i was looking for. Thank
@terrencetrinca8177
@terrencetrinca8177 3 жыл бұрын
I have seen this video floating around for a couple of months, never watched because it was 37 minutes long, lazy I know but truth. I am so glad I finally watched it as it clarified so much to me. Thank you!
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Ha! Yeah, I think that was one of my first coding videos, I'm still trying to get the length shorter, but I like to talk too much. Cheers!
@aiyushg1769
@aiyushg1769 3 жыл бұрын
@@alandmoorecodes3585 No, I completely disagree, many coding KZbinrs just write code you also explain it, which (in my opinion) is 5x more valuable :) I started with QT yesterday and cannot wait to write some basic applications :)
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
@@aiyushg1769 Thanks!
@Tetianaoutdoors
@Tetianaoutdoors 2 ай бұрын
Lol. Just bought the book last week and read all of it now found this. PERFECT.
@Rocket62AL
@Rocket62AL 2 жыл бұрын
Excellent video! Excellent presentation!
@alandmoorecodes3585
@alandmoorecodes3585 2 жыл бұрын
Thanks
@LeftThumbBreak
@LeftThumbBreak 3 жыл бұрын
I came to PyQt to get away from something similar in Kivy which I just couldn't reconcile myself with. Thanks much for explaining it so I could understand the similarity.
@retiredreplicant.2195
@retiredreplicant.2195 3 жыл бұрын
Nice tutorial. Thanks.
@greatindianbuilder2491
@greatindianbuilder2491 3 жыл бұрын
I have already made the mistake in making my application and already gone so deep in the development that I think it can't be undone. Will start from scatch again. I feel very lucky that I stumbled across your channel.
@HermannWinter
@HermannWinter 2 жыл бұрын
Excellent, thank you very much !
@asadmahmood6724
@asadmahmood6724 Жыл бұрын
You are a very good teacher 🔥 Respect from Pakistan !
@slickwillie3376
@slickwillie3376 2 жыл бұрын
LOL I was doing exactly what you said (copying and pasting). What great advice. No surprise you wrote the book on it. Gotta get the book.
@josephwilliamcosta
@josephwilliamcosta 3 жыл бұрын
Incredible video
@leoberges1705
@leoberges1705 3 жыл бұрын
Thank you so much ! Finally this make sense now .
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Awesome! glad it helped. :-)
@damianhancock4035
@damianhancock4035 2 жыл бұрын
you are a legend. thank you so much
@Huguillon
@Huguillon 3 жыл бұрын
I'm an artist and I always liked to learn programming languages... a few years ago I started learning Python by myself, searching tutorials here and there, when I knew about QT Designer I said to myself: "This is what I need, I'm an artist, I need visual design". Then, a few days later I understand is much more easy and fun (to me) code the full UI, it's make easy to me to add a "UI presets menu" to the app I was doing that let the user change the app apareance. Thanks for the video, is amazing
@Scion141
@Scion141 Жыл бұрын
Lol. Maybe it's because I'm NOT an artist, and I've been doing all manner of coding in the past 10 years. But I'm over coding my UI elements, especially when there's a better alternative, like using a designer program and dragging and dropping the elements that I need.
@miguelangelrivas8692
@miguelangelrivas8692 10 ай бұрын
i like this man, thank you so much, giant help!
@leej350
@leej350 2 жыл бұрын
It was interesting watching this video, because I’m reading your book (well, re-reading. Qt is complicated). On your ending comments about coding directly instead of using Designer: I do know from your book how you quickly create some sets of widgets (some of it’s not really ‘manual’, wink-wink.). But also, I’ve created a few more involved GUIs, and I can appreciate making some big changes in Designer, then quickly back up in running editing the slots and other methods without having to worry about the GUI code. So I’ll probably keep doing it both ways. Thanks for your book. Cheers. :-)
@georgeseese
@georgeseese 2 жыл бұрын
This has been very helpful. In 2022 Intellij Pycharm, I can start both Qt Designer and PyUIC by right-clicking in the Project pane. There still is the extra level of code but does not require running CMD. Thanks for your help.
@sorymillimono5931
@sorymillimono5931 Жыл бұрын
this is very hepful thank you.🤩🤩
@Inksaver
@Inksaver 3 жыл бұрын
As a C# developer and only recently discovered PyQt5, I am familiar with working with multiple files, and the idea you do NOT mess with MainForm.Designer.cs directly. I have been following a YT course using the designer, and doing exactly what you should not do, which worked well, but was frustrating if you need to re-design anything, so your video was an excellent introduction to the correct way to use it. I disagree with your views on using it in the first place, as I find beginners like to see instant results, especially when using CSS in the StyleSheet property. They can check their design and adjust it to perfection, which encourages them to tackle the code needed to interact with their shiny new GUI. Using PyQt designer is similar to using WPF in C#, where you can hand-code directly in XAML, or use the built-in WPF designer in Visual Studio. Book ordered from Amazon uk!
@marksalerno6539
@marksalerno6539 3 жыл бұрын
Thank you very helpful
@josys363
@josys363 Жыл бұрын
Now that is a serious Python developer who codes in emacs. :) BTW I really love your book on PyQt. Really helped me get started.
@jiakai7254
@jiakai7254 Жыл бұрын
needed this so bad
@somiarahmoun9662
@somiarahmoun9662 3 жыл бұрын
Perfect ! thanks a lot
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
You're welcome!
@SL-dv8og
@SL-dv8og 3 жыл бұрын
Thank you! This was very helpful. Now I'm having problems with my gui intermittently freezing when I try to update labels with setText.
@peterwooldridge7285
@peterwooldridge7285 Жыл бұрын
Nice one
@TechGuruSolve
@TechGuruSolve 3 жыл бұрын
perfect! thanks
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
You're welcome!
@4TH4RV
@4TH4RV 3 жыл бұрын
you can use pyside designer then form > view code in python to easily copy code so you dont have to open cmdr to convert it to .py everytime, its really useful
@josephwilliamcosta
@josephwilliamcosta 3 жыл бұрын
then you can't use pyqt the python code generated is for pyside. you have to do the method he showed to generate python code for pyqt.
@jpalmz1978
@jpalmz1978 3 жыл бұрын
Spot on! - been looking for this exact method using python + qt, thanks for the vid. I use vb.net c#.net and this kind of behaves like this as standard. I do like the QT editor though... Next step - opening another window within the main class ;-)
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Glad it helped!
@hfe1833
@hfe1833 2 жыл бұрын
This is it👍👍👍
@_whitecatfullgrown
@_whitecatfullgrown 2 жыл бұрын
It's kind a pain in the ass that i always edit and move my code every time i changed the design. You saved my time, thankyou
@hashirahmad5187
@hashirahmad5187 2 жыл бұрын
You should be knighted for this. Sir Alan D Moore sounds just right!
@alandmoorecodes3585
@alandmoorecodes3585 2 жыл бұрын
Thanks!
@tikadeutschland
@tikadeutschland 2 жыл бұрын
Hi, thanks for the tutorial. I am a beginner in python and I did it exactly the wrong way you've shown. Now I am modifying my code and do it the right way by having separate files main program and ui. However, i am still confused about the signal and slot method. For example I have a push button that is disabled initially but will be enabled once there is a textedit in a line edit. It seems to me that it should be done in the ui file instead of the main file. But I couldnt find the right signal and slot to connection to do this so I end up writing this connection in the main file. Any idea which one should be inside the ui and which one in the main?
@solomonraj9940
@solomonraj9940 3 жыл бұрын
Useful
@solomonraj9940
@solomonraj9940 3 жыл бұрын
Thank you
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
You're welcome :-)
@duncpol
@duncpol Жыл бұрын
I used loadUi to load UI from Qt instead of compiling it into python code, but that way you don't get auto-completion for widget object variables when using Pycharm.
@ratmadness4858
@ratmadness4858 2 жыл бұрын
thanks.
@jiakai7254
@jiakai7254 Жыл бұрын
for those trying to override code in Ui_MainWindow, u need to inherit it as well to have access to its objects.
@alialsoumahi4207
@alialsoumahi4207 2 жыл бұрын
It is really great advice but it has one drawback which is you need to recompile the QT designer code for every time you change on it to get the module and then included in main python file as described above on youtube vedio. My question is why we don't link the XML of the QT designer withen the python code and read that XML file automatically so once the QT designer changed, it will change as well in python code so no need for recompiling and get the python code of QT designer. My idea is actually taken from Java FXML. In Java FXML once we change in the scene builder automatically reflect on the XML which java will read and new change will be available for you to make custom functions to deal with your new change.t
@tedtoad2471
@tedtoad2471 2 жыл бұрын
Hello, great video! So I'm starting to work my way through the book. I'm using Visual Studio Code, did a pip install of PyQt5 ran the first couple of demos and all was good. Installed Designer and messed with it a bit then went back to my saved code in VSC and now get the error ImportError: DLL load failed while importing QtWidgets: The specified module could not be found. No matter what I do. Windows install, Python 3.8. Thanks. EDIT: Uninstalled PyQt5 and reinstalled and now it works. Seems Designer overwrote something PyQt5 needed.
@markustaugwalder8582
@markustaugwalder8582 4 жыл бұрын
Hi, great video! I wonder what is the difference to using uic and load the ui file with that when running the app in terms of inheritance, using the widgets from within the View class that inherits the Ui_Form, using them from an outside Model class and finally what about the signals? Do you recommend using uic or is it better the way you show us? I'm sorry for all these "heavy" questions. So far I couldn't find good answers for these, I only found bad examples.
@markustaugwalder8582
@markustaugwalder8582 4 жыл бұрын
I went through your videos and most helpful is this one: kzbin.info/www/bejne/a4LTmKiXg6uYmbM
@alandmoorecodes3585
@alandmoorecodes3585 4 жыл бұрын
Thanks Markus; keeping in mind that I'm not a huge fan of using QtDesigner, so I haven't worked out the best ways to make use of .ui files, I find that loading .ui files at runtime is a little awkward since it requires having a QApplication instantiated first. But maybe there's an elegant solution to that. Normally I just hand code the GUIs.
@angel_machariel
@angel_machariel 3 жыл бұрын
I come from C#/C++. Surely there's some Model-View design pattern for this. Edit: and this is a very good video telling how it is. If one would argue that GUI's are made in RAD's these days, then they forgot about the endless number of programmers who still use XAML to make GUI's in Visual Studio for example.
@calinapascu5241
@calinapascu5241 4 жыл бұрын
Hi! What if you have multiple windows that have to open? For exemple, if a pushbutton in pressed in the main window, then a second window shows up. I'd have both windows generated with qt designer. How do you write the code for main ?
@calinapascu5241
@calinapascu5241 4 жыл бұрын
Should I create different classes inside main.py ? But how do I show the second window and pass the variables ?
@alandmoorecodes3585
@alandmoorecodes3585 4 жыл бұрын
you would create a different subclass of QWidget for each window. Your callback in the first window would then create an instance of the second class and call it's .show() method. There is an example of one window opening another in my book, you can see the code here: github.com/PacktPublishing/Mastering-GUI-Programming-with-Python/blob/master/Chapter03/form_window.py It does not use QtDesigner, but the principle applies either way. The only difference is that each QWidget class's __init__ method would create the applicable UI class rather than manually building the widgets.
@atlantic_love
@atlantic_love Жыл бұрын
Anyone looking at QtDesigner and getting nostalgic vibes for Visual Basic from back in 1998? I remember that dotted grid very well. :(
@oleg7829
@oleg7829 3 жыл бұрын
im bad in English, but you talk very funny and interesting. Ty for the video
@engineeringstudent2700
@engineeringstudent2700 4 ай бұрын
23:01 so it should be used as a library. i have a question. can it be converted to an .EXE file easily later on?
@AnilKumar-hr8yl
@AnilKumar-hr8yl 3 жыл бұрын
Thank you it was really very well informed. How can we extend this code for multiple windows?
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
You'll just repeat the process for each window. Probably only the main application should be based on QMainWindow, the others should be QWidget-based. The thing to understand is that the code you get from designer is *not* your window/widget class, it's a ui builder that is meant to operate on a window/widget class which you provide.
@haleyharrison5653
@haleyharrison5653 4 жыл бұрын
Hello, I'm really glad I found your channel. It is the only one so far that actually has academic roots and I appreciate that. Do you have any code that uses pandas and PyQt5 together? I am trying to display some data from a database. Depending on the data my users choose, that data could look very different but with the same column names. I am trying to add check boxes inside the qtablewidget so users dont have to type the names of the rows they want to keep (additional processes are made with those names they choose later on). Here is what I have for putting the data into the qtablewidget. Is there an easier way? def update_table(self, df_name): self.ui.dataframe.setRowCount(0) self.ui.dataframe.setColumnCount(0) self.ui.dataframe.setRowCount(len(df_name)) self.ui.dataframe.setColumnCount(len(df_name.columns)) self.ui.dataframe.setHorizontalHeaderLabels( list(df_name.columns)) i = 0 while i < len(df_name): for col in df_name.columns: self.ui.dataframe.setItem( i, (df_name.columns.get_loc(col)), qtw.QTableWidgetItem( str( df_name[col].iloc[i] ) ) ) i += 1 And for the checkboxes inside the qtablewidget, is that possible/practical? The users basically just want to check something instead of type it in. Thank you in advance.
@alandmoorecodes3585
@alandmoorecodes3585 4 жыл бұрын
It's possible to put something other than a text widget in a tablewidget cell, but it breaks a lot of the automatic model/view behavior and you'll need to do a lot of custom code around it. I haven't done work with combining Pandas and Qt, but depending on how complex your application is going to be you might be better off building a model around your Pandas data. Then your GUI doesn't have to be so intimately tied to Pandas, the model can handle all that.
@haleyharrison5653
@haleyharrison5653 4 жыл бұрын
Thank you for the advice. I will research that a little more to see what I would need. I would be very interested in hearing/learning more about about the model-based views and how they are different from the widget based items in PyQt5. Thanks again!
@codenio
@codenio 3 жыл бұрын
One more point, we could use "loadUiType" function under "PyQt5.uic" package to load ui files directly into Main Window, which avoid conversion for .ui files into .py files # example code from PyQt5.uic import loadUiType Ui_MainWindow, QMainWindow = loadUiType('login_form.ui') class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) self.setupUi(self)
@avaze7
@avaze7 3 жыл бұрын
I heard it slows the App down at startup, if you load the ui file and dont use converted code
@codenio
@codenio 3 жыл бұрын
we could use this feature for rapid developement then. post developement we could move to .py files
@avaze7
@avaze7 3 жыл бұрын
@@codenio that's true. for me I dont care too much I just go to Form in qt Designer, view Code, click the copy Button got to the file and Ctrl-a ctrl-v
@mf4422
@mf4422 3 жыл бұрын
Hi Alan, It was very nice video. I am using your way. First design in QT designer, then use pyuic5 then create a second file to call the converted file and prevent to overwrite on pyuic5's file. But I have 1 problem which is making me crazy. Firstly, in the second file we use super().__init() to initialize. But if the class inherit from 2 other classes, one is pyuic5's file and the other class, how we can use __init__??? For the second class, for example call it ClassB, we can use ClassB.__init__(*arg), but what we should use for pyuic5??? If i dont use super().__init__() i will face with error, while if I use super().__init__ I can initialize ClassB :(((( So how we can solve the problem of parallel inheritances when one of them is related to pyqt?? . Br
@alharbi8357
@alharbi8357 2 жыл бұрын
hi whats different between PyQt4 and PyQt5
@user-cv6zu5cm4n
@user-cv6zu5cm4n 4 жыл бұрын
Hi , Could you please help me my Qt Designer on mac cannot support .jpg file? .ico file can be recognized.
@alandmoorecodes3585
@alandmoorecodes3585 4 жыл бұрын
Sorry I have no idea about that.
@ali-kadar
@ali-kadar 3 жыл бұрын
Hello, in this simple example all the method callbacks are defined in one module login_box_main.py which is fine. But for larger projects where the GUI may have many elements how can we define the method callbacks across different classes/modules. Thanks again for the nice explanation to begin with.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Check out this video, I think it might help: kzbin.info/www/bejne/iZ64i3h4jad-is0
@prashkd7684
@prashkd7684 3 жыл бұрын
Is there any benefit in converting .ui file to .py ? I assume we will still need pyqt5 installed in our environment??
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
In theory, you save some initial start-up compilation time, but I doubt this is significant in most cases. In all honesty, I'm not a fan of using QtDesigner at all, so I may be speaking from a place of ignorance, but I find the process of rendering .ui files in a script to be somewhat awkward. I find it simpler to just import a Python file if I'm going to go with the QtDesigner route at all.
@admiralEddie
@admiralEddie 2 жыл бұрын
how to hide title bar
@SolidBuildersInc
@SolidBuildersInc 3 жыл бұрын
Great Video and very insightful. What are your thoughts on using QT Designer and converting it to PySimpleGUI? Is there a clean "RAD" way to do this? Appreciate your feedback..... Thanks
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
I can't really comment with any authority on PySimpleGUI since I haven't used it. I'm probably the wrong person to ask about RAD tools though; I know everyone's after a RAD solution because that's more modern, but honestly I've just found that I get along better with code than with point-and-click interfaces.
@fuoadibrahim841
@fuoadibrahim841 3 жыл бұрын
I did everything you did @28 min, but for my new .py file I inherited from qtw.QMainWindow instead of qtw.QWidget because the GUI I created with QtDesigner was a QMainWindow. For some reason when I run my new .py file, it opens a blank GUI with the title "python". Do you have any idea what the issue could be?
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
It's hard to say without looking at the code.
@cjsmax75
@cjsmax75 2 жыл бұрын
my problem is that i couldn't connect the buttons to functions...
@SHONNER
@SHONNER 3 жыл бұрын
Do you happen to know when Qt Designer will be available for PyQt6?
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Sorry, don't know
@SHONNER
@SHONNER 3 жыл бұрын
@@alandmoorecodes3585 I ended up using PyQt5 instead. PyQt6 doesn't seem all that finished yet.
@ridwanawalin8990
@ridwanawalin8990 3 жыл бұрын
Hi. i have read your books, and i concern on raspberry Pi with pyqt5 python in chapter 15. I dont understand how to use GUI Pyqt in raspberry GPIO. Would you give a basic example program such as : 1. How to turning On LED with GUI PyQT 2. How to read Digital data input (example GPIO 04) from raspberry to display in GUI PyQT 3. How to make serial communication Read and Write with GUI PyQT or maybe more advanced 4. Using SPI, I2C communication with Raspberry in GUI PyQt thank you so much.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Thanks for your ideas. At the moment I can't do much with the Pi since my daughter has appropriated it for her own use; got a Pi 4 on the Christmas wish list, maybe I can do a new video if it shows up in my stocking. :-) In general, though, doing pretty much anything with a Pi and PyQt5 is going to run along the same lines as what was done in the book: create a QObject subclass to manage the GPIO interactions, use signals and slots to communicate back to the GUI, and use QThread to keep the GUI from locking up. The sensor example in the book could be adapted to any GPIO operations you want to run, really.
@asadmahmood6724
@asadmahmood6724 Жыл бұрын
How can i purchase your book from Pakistan, Sir , Please guide .
@StalkedByLosers
@StalkedByLosers Жыл бұрын
I'm sure I'm doing this wrong, but I did this but instead of QWidget I did it with QMainWindow. It essentially rendered multithreading useless. Now the GUI freezes whenever I do any long running processes, not an issue when I did it "the wrong way". I created a very large project "the wrong way" and was able to manage it with diffing code whenever I needed to go back and add some designer element (which I know is wrong and bad because it is difficult to manage). BUT I did not have issues with threads blocking the main window. Can you do another video like this but instead of QWidget, show how QMainWindow is supposed to be?
@YxOtsutsuki
@YxOtsutsuki 3 жыл бұрын
Hey Alan, I've got 2 questions. 1. It's Is it possible to create window or internet browser like transition in pyqt5? At present, we are using Qdialog to display the new window each time we click a button. 2. What is the best way to display images on our window? I and my friend are working on a project (DBMS with pyqt5) we have a lot character images to display.
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
You can do some things using QPropertyAnimation, but it's somewhat tedious and limited; it only works on Qt Properties, which many things you'd like to animate are not (colors, for instance). To make it work for those things, you have to implement them as properties in a subclass. QML might be a better approach if you want something really animated with fancy transitions. The simplest way to display an image is to put it in a QPixmap and display it with a label. Nothing wrong with that approach, but if you want to do fancier things or layer a lot of images (for a 2D game, for instance), you might look into a QGraphicsScene, which is Qt's answer to the Canvas objects you find in HTML/Tkinter/etc.
@YxOtsutsuki
@YxOtsutsuki 3 жыл бұрын
@@alandmoorecodes3585 thank you
@aiyushg1769
@aiyushg1769 3 жыл бұрын
@@alandmoorecodes3585 Do you know any good tutorials for QML with python?
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
@@aiyushg1769 I haven't found one yet that really resonates with me or takes time to explain things yet, but if I find a good one I'll point it out.
@aiyushg1769
@aiyushg1769 3 жыл бұрын
@@alandmoorecodes3585 Thanks a lot :)
@tamweiwen
@tamweiwen 3 жыл бұрын
how do i implement changing windows with this method?
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Can you clarify what you mean by "changing windows"?
@tamweiwen
@tamweiwen 3 жыл бұрын
@@alandmoorecodes3585 changing from one widget window to another
@sohambiswas8865
@sohambiswas8865 3 жыл бұрын
The right way=> 23:00
@AbbeyOmisol
@AbbeyOmisol 2 жыл бұрын
Hello, can you please help. I can't get the gui window to run. If I run the UiForm itself, the gui window do pops up. But when I ran it with the main script it only shows this message "runfile('C:/Users/user/Desktop/PY3/Trial_Files/sample_main.py', wdir='C:/Users/user/Desktop/PY3/Trial_Files')". Thanks in advance.
@alandmoorecodes3585
@alandmoorecodes3585 2 жыл бұрын
Sorry, I've never seen a message like that. How are you running your files?
@AbbeyOmisol
@AbbeyOmisol 2 жыл бұрын
@@alandmoorecodes3585 i am using spyder 4. Regarding the code, i believe i copied everything you showed in the video except for the variables. Having no error when running the code makes it so difficult to debug. ☹️
@alandmoorecodes3585
@alandmoorecodes3585 2 жыл бұрын
I've never used spyder, but I've heard it has problems with PyQt development. Try running your script from a command prompt, or from IDLE.
@AbbeyOmisol
@AbbeyOmisol 2 жыл бұрын
@@alandmoorecodes3585 hi, I tried running both Ui_Form and the Main Script on CMD. The former did popup the form but the latter did not. I added some print statements just so I can test its functionality, all of the print statement was printed fine. :(
@Fahodinho
@Fahodinho Жыл бұрын
30:40 bro's computer is about to fly
@melellington1333
@melellington1333 2 жыл бұрын
The example code presented in this video is not found at the link provided; only the full python code, not the code used to run the loginvox.ui file. Moreover, the code "submit_button" is not in the form, however, "pushButton" is - among other problems. The author has conflated a mix of files from the video above and the referenced "Example code for this video" which requires a lot of debugging to get this thing to work. I recommend seeking some other more reliable source of information on this topic to avoid a lot of trouble and confusion.
@TheFreddy3kid
@TheFreddy3kid 3 жыл бұрын
What OS are you using?
@alandmoorecodes3585
@alandmoorecodes3585 3 жыл бұрын
Arch linux
Master PyQt5 part 1:  Hello World and Template
27:48
Alan D Moore Codes
Рет қаралды 19 М.
How to use Qt Layouts
19:18
Velcode
Рет қаралды 89 М.
Became invisible for one day!  #funny #wednesday #memes
00:25
Watch Me
Рет қаралды 25 МЛН
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 8 МЛН
Я нашел кто меня пранкует!
00:51
Аришнев
Рет қаралды 2,5 МЛН
Using Qt Designer files in PySide6 or PyQt6
27:28
Jason Codes Qt
Рет қаралды 9 М.
Multiple Screens in PyQt5: Switch screens without opening a new window
11:43
Code First with Hala
Рет қаралды 91 М.
Master PyQt5 part 4: Introduction to Signals and Slots
29:24
Alan D Moore Codes
Рет қаралды 24 М.
Working With Qt Designer's UI Files And PyQt
19:17
DistroTube
Рет қаралды 15 М.
PyQt5 Tutorial - Signals and Slots
16:47
Tux Codes
Рет қаралды 14 М.
Tkinter vs. PyQt:  Which Python GUI framework is right for you?
38:11
Alan D Moore Codes
Рет қаралды 64 М.
Creating PyQt Layouts for GUI Python Applications
13:56
Real Python
Рет қаралды 29 М.
Игровой Комп с Авито за 4500р
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,8 МЛН
Мой инст: denkiselef. Как забрать телефон через экран.
0:54
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 8 МЛН
В России ускорили интернет в 1000 раз
0:18
Короче, новости
Рет қаралды 1,1 МЛН
Hisense Official Flagship Store Hisense is the champion What is going on?
0:11
Special Effects Funny 44
Рет қаралды 2,5 МЛН