Thanks Man, for the video series. I am re-learning pyQt5 after an 3 years break. Great stuff, easy to understand, straight to the point. Much appreciated and look forward to go through the whole series.
for the icon, the icon should be in the same folder as the .py file you are creating. if it is in a folder, the folder should also in the same path of .py file and put (QtGui.QIcon("./Foldername/image_name.png"))
I have integrated the front end with a backend tool script. Now on the click of a button, say "Restart tool" I want the session to be the default one as if I have re ran the code to get the home GUI. How do I do the same?
Awesome. Thank you. Also could you add a bit of "why" vs just "how" in your lectures. For example, why does your Window class inherits from QMainWindow. Are you extending the class? Why isn't it a use-a relationship and is a has-a relationship. It seems to me that Window simply uses services of QMainWindow class and the rest of Qt classes. My example might be a bit loud (over-kill), but I was trying to clarify the question. I leave you with this ... if you ever see bunch of people hovering over something and wonder who is who....the guy that says "how" does this work, is a technician, the guy that says "why" does it work, is an engineer and the guy that says "when" would this work? is a manager.
yea thanks i will do that in the further videos , basically there three kinds of window class that you can use in pyqt5, the first one QMainWindow that is a main window that you can have menu, menubar.menu item, status bar for that, the another one is QWidget, also we have QDialog window
Hello Parwiz - Great video - curious to see how the rest of the series will be. One point that would have been helpful for me is to explain a little more why certain functions are used. self.height etc. are obvious, but why sys.exit, why sys.argv. Not sure what level of Python programmer this is aimed at but for me, I can code these up, but lack the full understanding of why we do it
Hi Parwiz, The video series is just awesome . Could you please make a quick video for Mobile application development using PyQt ?? That will be really helpful.
The video was really good and informative. In the place where the super function is called to inherit QMainWindow, I had to call it like super(Window, self).__init__() instead of super().__init__(), because, I got a TypeError which said 'descriptor '__init__' requires a 'super' object'. I wonder why the error didn't come for you...
When I Run the code nothing appears (I use the IDE spyder of Anaconda wich I can launch Qt Designer projects with). Moreover the command "sys.exit(App.exec())" freezes my prompt
Sorry for the downvote, I've changed it. Can you explain the use of "sys.argv" in App = QApplication(sys.argv) and why use the sys.exit() method for the App.exec() in sys.exit(App.exec())?
PyQt5 application must create an application object. The sys.argv parameter is a list of arguments from a command line.Python scripts can be run from the shell. It is a way how we can control the startup of our scripts. App.exec() entering to the mainloop of the application. The event handling starts from this point. The mainloop receives events from the window system and dispatches them to the application widgets. The mainloop ends if we call the exit() method or the main widget is destroyed. The sys.exit() method ensures a clean exit. The environment will be informed how the application ended.
Hello, i using VS Code to run your code but have error " self.InitWindow() AttributeError: 'Window' object has no attribute 'InitWindow' ", What is my problem?
I had the same problem in Pycharm. It was as a result of line spacing and indentation. So, delete the line 'self.InitWindow() ' then place your cursor at the end of the line above it 'self.height = 300', hit enter twice to start a new line and type the line 'self.InitWindow() ' again. I used the autocomplete suggestion while typing it again. Hope that helps someone else who may face same problem.
Hi, I cannot see my icon in the window, is there a suggested size for the icon ? or maybe the path, I have my icon file(.png) in the same path of my .py file. Do you know what could be the problem ?
Why does this error happen? File "/home/uname/Documents/Projects/Python/QT5_Learning/main.py", line 24 sys.exit(App.exec()) ^ SyntaxError: invalid syntax [Finished in 3.6s with exit code 1] [shell_cmd: python -u "/home/uname/Documents/Projects/Python/QT5_Learning/main.py"] [dir: /home/uname/Documents/Projects/Python/QT5_Learning] [path: /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin] The I typed in the code and thought I might have added something but then I copied it from you blog page and sill get the same thing!
@@ParwizForogh I'm using sublime text to write in and running from command line in Linux. Also I copied and pasted the script from your example page to eliminate any possible typing errors on my part and I still get the same error. However after reading your reply i did try it from IDLE and it worked. Also I added #!/use/bin/python3 at the top and it now works from the command line. Thanks for pointing me in the right direction.
Sorry but I think we use pyqt5 to create controls without programming, but I see you use code like tkinter so what is the benefice of using pyqt5🤔😶 (Sorry I am just binging) Thanks
@@ParwizForogh I got a lot according your tutorial video even through it is the basic. If you have time that upload the pydesinger -> pyuic that's better I guess.
i'm getting this error i've installed pyqt5 through pip install pyqt5 ;( from PyQt5.QtWidgets import QMainwindow, QApplication ModuleNotFoundError: No module named 'PyQt5'
موفق باشی رفیق راستی در ارتباط به پرداخت یوتیوب در افغانستان کمی اطلاعات میخواستم و مطمئنم که خودت بامن همکاری کرده میتوانی . میتوانی یک راه ارتباطی با خودت به من بده .
@Edmund Keeling You know what else isn't helpful? Telling a guy how to make his file, that only works with the python runtime installed, into a larger executable which give no benefits whatsoever.
@Edmund Keeling Actually, it is up to me. Without people like me explaining they're doing something inefficiently they'll continue to do it that way, never making good progress. Explaining to someone there is a better way to do something is way easier and beneficial than explaining how to do something ineffectively. How exactly do you think the age of information has made it this far? Because people try to help others get better, instead of stay the same. So don't come at me trying to claim what I say is irrelevant because it wasn't asked for. Nuitka and Pyinstaller are 2 easy compilers for python, and also don't bring any advantages, as a matter of fact, they bring 1 huge disadvantage, that being the file size. Pyinstaller will turn your 1 KB file into an 8 MB file, Nuitka isn't as bad, but it's still not amazing. The best you get is that people can't read your code, which let's be honest, you can easily find an exe2python file on Sourceforge. Make a difference by helping people with benefits by recommending useful stuff, if you don't have the experience to actually help, I think you sir, should shut up.
@Edmund Keeling "bragging" imagine saying I'm bragging. You specifically targeted me telling me it's NOT my job to help people grow, when in reality it is. It's every experienced programmers job to help others. That's not bragging, that's being helpful. You say I didn't need to claim you don't have experience, but if you don't like that statement, then you shouldn't of made me think it. I think I'm done here anyway.