In case anyone was wondering, 11:11 if xor == True: #turn everything into an int xor = 1 else: xor = 0 can be replaced with(for the same result as above): xor = bool(xor) Also, thanks for these videos Tim.
Great video Tim, but I would point out that editing the python file that was generated by pyuic5 is a bad idea, because it prevents you from doing any further edits to the .ui file - as it would recreate the python file and you'd lose your changes. Instead the proper process is to import that python file and then subclass it, and add the additional features / events there.
I had an issue on mac that the text of label doesn't update after its method was called After inserting an self.label.repaint() the update process runs smooth
I am writing command inside the qt designer so how can I make rounded drop list view. I tried and it worked but the main problem is that the background behind that rounded area is also visible.
Hi Tim, I'm wondering how to assign "Hint text" to the combo box ? That will be disappeared when select any item from the combo box. Another question, is there an event for the list when dropped down? Thanks
Very, very good video just as the other stuff you make. Thanks a lot. Just a little remark, the code could be smaller by replacing the code line 73 to line 76 by : xor = x ^ y
Very instructive and enjoyable but... Why do these programs not run outside an environment like Thonny on Linux ? I don't know what environment Tim is using. No problem with simple programs that use only "import os" but create no windows so I know it needs access to QT components. But how to include them? Edit: Answering my own question: enter this as first line in the .py script: #! /usr/bin/env python3 and change the file permissions to make it executable I wonder if it will work in Windows now. I haven't tried yet.
Can we use the current value of the COMBO Box to change the value in the string? for eg. i have a string"A,1,1,XY" this XY are the values that need to be inserted after selecting from combo box and this must be done every time the value is changed from the box.
Hello, can you teach us how to make a cobobox with pyqt that can search all the values by entering text, for example by entering po it will show all the following parameters (hello pow) or police and so on.
Hello can you help me? I inserted data from a database table into my comboBox Now I need to get the ID of this Table when I select the item in the ComboBox to insert in the foreign key of my second table. Can you do that?
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.
At ua-cam.com/video/crJVzc5Ct_s/v-deo.html you can also use this: answer = ("False", "True")[(x and not y) or (not x and y)] instead of an if statement. The False/True tuple will use the index of the xor test and return "False" (index 0) or "True" (index 1). That way, you don't need the xor variable or an if statement.
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.
Separate the UI file from the Python file by importing the module uic: from PyQt5 import QtWidgets, uic Then load the UI by specifying the UI file: window = uic.loadUi("mainwindow.ui") This way you can make changes to the UI without losing the logic.
Enroll in my new course and get 50% off with the code: EARLYACCESS
tech-with-tim.teachable.com/courses/the-fundamentals-of-programming-with-python/
It says invalid copuon
ya it expired... you can use 50K for 35% but only today!!
Are there any coupons now?
In case anyone was wondering, 11:11
if xor == True: #turn everything into an int
xor = 1
else:
xor = 0
can be replaced with(for the same result as above):
xor = bool(xor)
Also, thanks for these videos Tim.
You can just do this:
xor = int((x and not y) or (not x and y))
The integer of True is 1 and of False is 0 (Based on truthy and falsy values)
A tutoriel on QTabWidgets would be really cool !
Daily uploads are really appreciated Tim ;)
def XOR(self, X, Y): return int(X != Y)
Great tutorial, and the text-based version is of great help. Thank you very much.
thank you man you saved my night
Thanks man you just saved me a headache
Well done!
Thank you so much ❤
Thank you brother. God bless you
you can just do
xor = x ^ y
python (like all programming languages) has xor operator built in
def pressed(self):
num1 = int(self.comboX.currentText())
num2 = int(self.comboY.currentText())
result = num1 ^ num2
self.label.setText(f"{num1} XOR {num2} = {result}")
Thank you very much for the video, you helped me a lot
Great video Tim, but I would point out that editing the python file that was generated by pyuic5 is a bad idea, because it prevents you from doing any further edits to the .ui file - as it would recreate the python file and you'd lose your changes. Instead the proper process is to import that python file and then subclass it, and add the additional features / events there.
Man this is a really great idea. I owe you man!
I thought the same as you and basically solved it like this
please make tutorial on Layouts in detail
i love your videos
Tim, how can i accomplish the same but without Submit button? I want to give me result once either of comboboxes is changed
Thanks in advance.
Brilliant Thankyou
I love your tutorial, it's very cool!
Very nice, but will be also very nice if there is a more deep approach
this is very great video , it pretty clear explanation , do u plan to have any python with QML ? really looking forward and million thx
Tim, please consider loading the . ui files within the .py. instead of converting them.
how to do that?
What if we have two combo boxes are radio buttons and we want to make sure that the user will be able to press submit button once we have both inputs?
nice tut sir
Hey Tim! I love your videos. Can you make a C++ tutorial if you are interested in C++. I'd like to learn it from you.
or one can just cast True or False into int and then you don't need to add those if statement like int(x and not y) | (not x & y))
I had an issue on mac that the text of label doesn't update after its method was called
After inserting an self.label.repaint() the update process runs smooth
I spent 3 hours finding that functions yesterday!
Will you be making a big project in this series ??
Hi, it gives to me the error "Name error. Ui_MainWindow is not defined" and then the program crushes. How is it possible resolve it? Thanks.
Thanks
Hey Tim mine just works one time although i implemented the code at the exact same place. Any ideas?
I am writing command inside the qt designer so how can I make rounded drop list view. I tried and it worked but the main problem is that the background behind that rounded area is also visible.
Hi Tim,
I'm wondering how to assign "Hint text" to the combo box ? That will be disappeared when select any item from the combo box.
Another question, is there an event for the list when dropped down?
Thanks
just saying, i am pretty sure he wouldn't reply to questions in a year old video
Very, very good video just as the other stuff you make. Thanks a lot. Just a little remark, the code could be smaller by replacing the code line 73 to line 76 by : xor = x ^ y
great video
The program says to me . Why?
Hello.. How can I add multiple columns to a ComboBox and hide some of them ?
in line 67 command has changed in new version
"submit" is replaced by "pushButton"
You could have just used the Boolean operator '^' for XOR operation in the python instead.
Very instructive and enjoyable but...
Why do these programs not run outside an environment like Thonny on Linux ? I don't know what environment Tim is using. No problem with simple programs that use only "import os" but create no windows so I know it needs access to QT components. But how to include them?
Edit: Answering my own question:
enter this as first line in the .py script:
#! /usr/bin/env python3
and change the file permissions to make it executable
I wonder if it will work in Windows now. I haven't tried yet.
Can we use the current value of the COMBO Box to change the value in the string?
for eg. i have a string"A,1,1,XY" this XY are the values that need to be inserted after selecting from combo box and this must be done every time the value is changed from the box.
When I pass the " 1 " or " 0 " in the findText() function i am getting -1 as return value. Is there any other format for numbers?
great!
I'm trying to do something similar but when I press my button it closes my main window, do you know what could be causing this?
Hello, can you teach us how to make a cobobox with pyqt that can search all the values by entering text, for example by entering po it will show all the following parameters (hello pow) or police and so on.
You can pls make a gui tutorial with tkinter or other module
Hello can you help me?
I inserted data from a database table into my comboBox
Now I need to get the ID of this Table when I select the item in the ComboBox to insert in the foreign key of my second table. Can you do that?
I used the exact same commands, how come I cannot get error: name 'pressed' is not defined.
Oh, shoot. It is (self.pressed) instead of (self,pressed)
you are god
Can you show us how to get keyboard input?
Muito obrigado!
For anyone wondering, Python has an xor operator using "^"
Don't do what this guy did.
thanks.
Now, cannot find reference 'connect' in 'function'. What should I do?
Also, x = int(...) has error: Invalid Literal for int() with base 10:' '
why not use bool()?
Can you just make a tutorial on pyqt5 threading
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.
Sorry, I accidentally repeated the post.
why not just xor=x^y ?
cant you just make variable xor a boolean and then it would always return True/False
hi Tim! i really Enjoy your videos plz heart
I got you ;)
tim both 35% and 50% are 79$ why is it so?
You need to use the discount code at checkout
maybe str(bool(xor))?
Is there a way to change the style to fusion in qt5
has anyone found any other good Qt tutorial thats complete?
How to populate it from SQL?
nice nice
No reason to use: "xor = (x and not y) or (not x and y)" just use: "xor = x ^ y"
At ua-cam.com/video/crJVzc5Ct_s/v-deo.html you can also use this: answer = ("False", "True")[(x and not y) or (not x and y)] instead of an if statement. The False/True tuple will use the index of the xor test and return "False" (index 0) or "True" (index 1). That way, you don't need the xor variable or an if statement.
Нормально, нормально
self.label.setText("X XOR Y = " + str(int(xor))) - for lazy people like me, just use conversion on xor variable. No more TRUE & FALSE problem.
XOR(x,y) = x!=y
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.
Separate the UI file from the Python file by importing the module uic:
from PyQt5 import QtWidgets, uic
Then load the UI by specifying the UI file:
window = uic.loadUi("mainwindow.ui")
This way you can make changes to the UI without losing the logic.