In case this is useful to anyone else: I was having a hard time getting the Qmessagebox to center on the main window (rather than the screen.) I fixed this by inheriting from MainWindow when defining msg like so: msg = QMessageBox(MainWindow)
You're really NOT supposed to edit the main .UI file that's generated by QT Designer. From my simple research, it's best to just import the .UI file into a new .py file instead of converting the .ui file into a .py file because you will need to continue editing the ui file or making changes to it and you don't want to keep exporting and overwriting it each time that you convert it. So the real way is to continue on by importing it instead. Then you'll be able to keep editing the main .ui file without making any changes to the main py file that you're using to import the .ui file.
If we change the ui file and overwrite the python file again, won't all of your changes and methods disappear? Edit: How do we fix this issue? Can we inherit the class Ui_MainWindow in another py file? That is what I used to do in PyQt4 Thanks in advance.
The return value from msg.exec_() would be the state of the button right (OK button in this case)? How else would you know if the user clicked ok or closed the window
8:10 how come when you are calling the function self.popup_button you don't need to use a lambda function in order to pass an extra parameter (the button itself) like you showed in a previous video?
Why don't button match their position from msg.setStandardButtons? You typed "Cancel Retry Ignore", but in the window there are "Retry Ignore Cancel" (and "Ignore Cancel Retry" on my computer). Your "Show Details" button appears as the 3rd, mine does as the 1st. Also, my Cancel button has its letter C underlined and can be pressed with C key, and the program prints "&Cancel" in the terminal when I press it.
Hi Tim, I am trying to do a small software for ecommerce in which will have inventory, picking, packing, despatch, users...would you recommend PyQt5 for this or have any other suggestions? Great content, keep it up (Y) !
After I translate the ui file into python, and I write code in it, but how can I transform back to an ui file where I can still edit it with all my code saved?
Hi, Is it possible to add the rows and column dynamically ? Can you Please make a video about QTableView. especially for matrix operation like multiplication
actually the _exec() method returns an int code that shows which button was pressed .. so for each button type there is an unique code. so the x variable is there to save the returned code.
I did this and have small problem, when I click cancel in the popup window, the python shell prints "&Cancel", in the other buttons no problems. Thanks in advance. I have subscribed your channel
Thanks for this video. However, it does not seem practical for this reason, especially for Questions. Wherever an issue arises (e.g. "file not found"), need to resolve that issue in a unique way Where the issue arises, not in Dialog code. Issues found elsewhere (e.g. "name is missing") have other reactions. I've seen in other languages something like "If reply == 'yes' do A, else do B". The reply is returned from Dialog box code. The reactions A and B may be different with each issue. We shouldn't need separate Dialog boxes for each issue. Does PyQt5 not have the return value or does your video not include this for some reason?
Here is sample code to use at point of issue: reply = QMessageBox.question(self, 'title', 'issue question? ',QMessageBox.Yes, QMessageBox.Cancel,) then on next line: if reply == Qtw.QMessageBox.Yes: do A. EDIT: This does not use the show_popup function in your video.
I use VScode. and 3:42 when i type 'cri...' a context menu? appears. And it recommends 'critical' not 'Critical' but when i compileed? the program. it didn't work. When 'Critical' then worked
Why when I create a simple message box, run the program, box shows up and then I pressing OK and... whole program crashing. Code is similar that yours...
Hi Tim, I was doing a login system and I want to pop up this Qmessage if the email is not matched. The function does work, but for how many times (let's say 4) i click login button with wrong email, the function seems to remember it and once i successfully logged in, the message box will show that many times (in this case 4). Is there any way to solve this issue? Thanks
Can sb explain how popup_button function "understands" where to take data for parametr clicked_button? because we don't put any parametrs when connecting this function msg.buttonClicked.connect(self.popup_button) I understand that we can't use brackets and if we like to pass parameters we should use lambda instead. But here we just do nothing and parametr is passed inside popup_button function... Confused...
Hi, i ran into the following issue when i tried to import the lib: "No name 'QMessageBox' in module 'PyQt5.QtWidgets' " Does anyone know how to fix it?
I got the same thing but then noticed a syntax error in my typing. You get that error when you paste in this line? from PyQt5.QtWidgets import QMessageBox
i copy the same text you out in this tutorial but an error message pop up says " line 10 in from PyQt5.QWidgets import QMessageBox " moduleNotFoundError: No module named 'PyQtf.QWidgets'
ERROR: Could not find a version that satisfies the requirement pyqt5-tools (from versions: none) ERROR: No matching distribution found for pyqt5-tools this is the error i am getting, when i tried to install this. I am using Ubuntu 18.04, python 3.7.3, and pip 19.1.1 i also tried to search about this problem, i came to know that, this pyqt5-tools only supports windows not for linux. Can u suggest me some other. what should i do? i am not going to windows for this. any help will be useful.
give ya a 2 thumber. Do you have / or know how to load images from url? I cant seem to find a straight forward way to do so in PyQt5. I can do it with tkinter but I want to user PyQt5 to build my interface. I really want to stick with pyqt if at all possible.
anyone having error with self.button.clicked.connect(show_popup), stating show_popup not defined? I have the method verbatim to this tutorial, but receiving error.
I like how he completely ignores the warning message to not edit the file :D He is going to cause a lot of people shoot themselves in the foot when they accidentally overwrite their work.
I know that I am late the " | " is called a "pipe" --- thanks for the videos. New to Python and Qt -- learning a lot here. Thank you.
In case this is useful to anyone else: I was having a hard time getting the Qmessagebox to center on the main window (rather than the screen.) I fixed this by inheriting from MainWindow when defining msg like so:
msg = QMessageBox(MainWindow)
wow good thank you.
Thankyou so much for this, this is what I needed lmao.
Very good tutorial on PyQt5.This playlist is helping me a lot.
8:50 you can close all with one click. click right to window icon bottom and select close all.
This series is straight to the point thank you man
this is the best tutorial yet I have ever seen. So thanks
TIA
You're really NOT supposed to edit the main .UI file that's generated by QT Designer. From my simple research, it's best to just import the .UI file into a new .py file instead of converting the .ui file into a .py file because you will need to continue editing the ui file or making changes to it and you don't want to keep exporting and overwriting it each time that you convert it. So the real way is to continue on by importing it instead. Then you'll be able to keep editing the main .ui file without making any changes to the main py file that you're using to import the .ui file.
Man you are the coolest guy I have ever seen Thanks a lot. It is much easier to comprehend python with your videos.
If we change the ui file and overwrite the python file again, won't all of your changes and methods disappear?
Edit: How do we fix this issue? Can we inherit the class Ui_MainWindow in another py file? That is what I used to do in PyQt4
Thanks in advance.
Man, why did I find this channel so late.
Wonderful video. your tutorials are just what I need to understand how PyQt5 works. kudos
Thanks for your efforts Tim.. please keep it up
Thank you for the very gud Tutorial! and the show_popup function you don't need a variable there only "msg.exec_()"
Man ! You Nailed Every details
The return value from msg.exec_() would be the state of the button right (OK button in this case)? How else would you know if the user clicked ok or closed the window
Which one is better? this or kivy?
I have used kivy and prefer this way over that
8:10 how come when you are calling the function self.popup_button you don't need to use a lambda function in order to pass an extra parameter (the button itself) like you showed in a previous video?
How do you get each button to do different things?
Why don't button match their position from msg.setStandardButtons? You typed "Cancel Retry Ignore", but in the window there are "Retry Ignore Cancel" (and "Ignore Cancel Retry" on my computer). Your "Show Details" button appears as the 3rd, mine does as the 1st.
Also, my Cancel button has its letter C underlined and can be pressed with C key, and the program prints "&Cancel" in the terminal when I press it.
Super helpful, many thks
Awesome Bro wish you success
thank you for this. it's very detailed and informative.
Can we make like a bigger popup? Like a menu or smth?
Thank you brother
Can i use tkinter messagebox instead pyqt5? In tkinter we can 100x easier show a warning or error box.
Thanks. I wish you add LCD and how to display values on it.
Hi Tim,
I am trying to do a small software for ecommerce in which will have inventory, picking, packing, despatch, users...would you recommend PyQt5 for this or have any other suggestions?
Great content, keep it up (Y) !
pls tell me which path you would recommend now after 2 years as you may have experience now
How do I close a message box without the whole application crushing? Pyqt5
is PyQt5 easier that kivy ? and if i want to get values and run operators on it with is easier to use ?
Pyqt designer is so nice
After I translate the ui file into python, and I write code in it, but how can I transform back to an ui file where I can still edit it with all my code saved?
I find this tutorial very inforamtive.
Awesome tutorials Tim! Keep it up :):)
I have subscribed to this awesome channel
You are awesome, solved my problem! thank you!
Thanks : merci beaucoups pour les bonnes leçons.
How can i add line edit on message box?
I hope that this tutorial to have some continuation...
so sad that it's just 8 episodes
Great job Tim!
You earned a new subscriber and I will share your channel to my friends for more subscriptions.
Looking forward for more videos.
Thanks
Brilliant Thankyou
I'm wondering how to use the exit button to exit the message box
any answers please???
Hi,
Is it possible to add the rows and column dynamically ? Can you Please make a video about QTableView. especially for matrix operation like multiplication
I wanna thank you for the videos They are very useful for community I was wondering if you are going to make video about tts and stt..
I'm having a problem where my window closes every time i click the button what should i do
Thank you Sir
How can i create an Output code in pyqt5 ? I need to see the output codes in interface after pack to .exe
Nice tutorial, I think, we can leave x variable also right, if exec_() shows the pop-up, cuz I don't think we need to store any data in x🤔
actually the _exec() method returns an int code that shows which button was pressed .. so for each button type there is an unique code. so the x variable is there to save the returned code.
@@deiaabdullah2008 yes, but I don't think we need to use that data...
I did this and have small problem, when I click cancel in the popup window, the python shell prints "&Cancel", in the other buttons no problems. Thanks in advance. I have subscribed your channel
The ampersand (&) serves as the shortcut symbol; so in the UI the first C of Cancel should be underlined.
Thanks for this video. However, it does not seem practical for this reason, especially for Questions. Wherever an issue arises (e.g. "file not found"), need to resolve that issue in a unique way Where the issue arises, not in Dialog code. Issues found elsewhere (e.g. "name is missing") have other reactions. I've seen in other languages something like "If reply == 'yes' do A, else do B". The reply is returned from Dialog box code. The reactions A and B may be different with each issue. We shouldn't need separate Dialog boxes for each issue. Does PyQt5 not have the return value or does your video not include this for some reason?
Here is sample code to use at point of issue: reply = QMessageBox.question(self, 'title', 'issue question? ',QMessageBox.Yes, QMessageBox.Cancel,)
then on next line: if reply == Qtw.QMessageBox.Yes: do A. EDIT: This does not use the show_popup function in your video.
Thank You great video
I use VScode. and 3:42 when i type 'cri...' a context menu? appears. And it recommends 'critical' not 'Critical' but when i compileed? the program. it didn't work. When 'Critical' then worked
thanks to help me :)
1763 Feest Bridge
Why when I create a simple message box, run the program, box shows up and then I pressing OK and... whole program crashing. Code is similar that yours...
Hi Tim, I was doing a login system and I want to pop up this Qmessage if the email is not matched. The function does work, but for how many times (let's say 4) i click login button with wrong email, the function seems to remember it and once i successfully logged in, the message box will show that many times (in this case 4).
Is there any way to solve this issue?
Thanks
You should store how many times the user failed in a variable(or in a file if you want the value to be kept when you run the program any time)
Hi Tim can i build professional android app with out java just on python
Try kivy, but python is not the best language for android apps
I have this problem: "module 'PyQt5.QtGui' has no attribute 'QMessageBox'"! Can someone help me?
Can sb explain how popup_button function "understands" where to take data for parametr clicked_button?
because we don't put any parametrs when connecting this function
msg.buttonClicked.connect(self.popup_button)
I understand that we can't use brackets and if we like to pass parameters we should use lambda instead.
But here we just do nothing and parametr is passed inside popup_button function...
Confused...
if this i is passed "by default" as extra parameter when you click the button, then where can I read about this in documentation?
And also btw popup_button(self, i) doesn't work properly with detailed text button - no reaction on click :(
Thank you
How do I change the position of buttons inside message pop-up box? I tried searching for it online but to no avail. Can anyone help?
Very nice 👌👌
Hi Tim I Love Your Videos I Just Wanted To Say Please Make Roulette Game In Python In A Live Stream
Is there a site where I can view all the commands that Tim is explaining to us? I googled it but I couldn't find anything
This could be of some help: doc.qt.io/qt-5/qmessagebox.html
Hi, i ran into the following issue when i tried to import the lib: "No name 'QMessageBox' in module 'PyQt5.QtWidgets' "
Does anyone know how to fix it?
I got the same thing but then noticed a syntax error in my typing. You get that error when you paste in this line?
from PyQt5.QtWidgets import QMessageBox
@@BoDuke73 i still get the same error, i don't know if it involves something with the version...
i copy the same text you out in this tutorial but an error message pop up says " line 10 in from PyQt5.QWidgets import QMessageBox "
moduleNotFoundError: No module named 'PyQtf.QWidgets'
PyQt5 it is. You must have typed PyQtf
"|" -> pipe symbol
ERROR: Could not find a version that satisfies the requirement pyqt5-tools (from versions: none)
ERROR: No matching distribution found for pyqt5-tools
this is the error i am getting, when i tried to install this.
I am using Ubuntu 18.04, python 3.7.3, and pip 19.1.1
i also tried to search about this problem, i came to know that, this pyqt5-tools only supports windows not for linux.
Can u suggest me some other. what should i do? i am not going to windows for this. any help will be useful.
It's a bit different for Ubuntu:
gist.github.com/ujjwal96/1dcd57542bdaf3c9d1b0dd526ccd44ff
thanks.
give ya a 2 thumber.
Do you have / or know how to load images from url? I cant seem to find a straight forward way to do so in PyQt5. I can do it with tkinter but I want to user PyQt5 to build my interface. I really want to stick with pyqt if at all possible.
Damn i was too late to subscribe to your channel. I hope it gathers steam in the coming days. Keep the videos coming and all the best
anyone having error with self.button.clicked.connect(show_popup), stating show_popup not defined? I have the method verbatim to this tutorial, but receiving error.
got it to work with self.button.clicked.connect(self.show_popup). couldn't just pass show_popup as argument to connect.
PyQt5 is much better than tkinter, man.
I like how he completely ignores the warning message to not edit the file :D
He is going to cause a lot of people shoot themselves in the foot when they accidentally overwrite their work.
python has stopped working ._.
he is creating each video of the tutorial series in a totally new place. I wonder how rich he is.
or even your email
sorry..자막이 없습니다.ㅠㅠ
not is a meme seriously
Говорил бы, ты по русски - цены бы тебе не было👍🏻