No video

PyQt5 Tutorial - ComboBoxes with Examples

  Рет қаралды 122,765

Tech With Tim

Tech With Tim

5 жыл бұрын

This pyqt5 tutorial will show you how to use combo boxes! Comboboxes allow for the user to see a drop down list of options and select one. This tutorial will illustrate their use with a short example:
Text-Based Tutorial: Coming Soon...
Playlist: • PyQt5 Tutorial - Setup...
Enroll in The Fundamentals of Programming w/ Python (NOW 35% OFF)
tech-with-tim.teachable.com/p...
Use the code: 50K
to get 35% off!
Get %30 off a GitPod.io subscription with the code: techwithtim
www.gitpod.io/
Instagram: / tech_with_tim
Website techwithtim.net
Twitter: / techwithtimm
Discord: / discord
GitHub: github.com/techwithtim
Podcast: anchor.fm/tech-with-tim
One-Time Donations: www.paypal.com/donate/?token=...
Patreon: / techwithtim
Please leave a LIKE and SUBSCRIBE for more content!
Tags:
- Tech With Tim
- Python Tutorials
- PyQt5 ComboBox
- ComboBoxes PyQt5
- PyQt5 Tutorial
#python #pyqt5 #qtdesigner

Пікірлер: 90
@TechWithTim
@TechWithTim 5 жыл бұрын
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/
@arbazkhan8320
@arbazkhan8320 5 жыл бұрын
It says invalid copuon
@TechWithTim
@TechWithTim 5 жыл бұрын
ya it expired... you can use 50K for 35% but only today!!
@tung-hanwu5865
@tung-hanwu5865 2 жыл бұрын
Are there any coupons now?
@anabelsa
@anabelsa 3 жыл бұрын
Great tutorial, and the text-based version is of great help. Thank you very much.
@xgriff91
@xgriff91 5 жыл бұрын
A tutoriel on QTabWidgets would be really cool ! Daily uploads are really appreciated Tim ;)
@yisanhuang9298
@yisanhuang9298 4 жыл бұрын
I love your tutorial, it's very cool!
@tundeo7675
@tundeo7675 4 жыл бұрын
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.
@priyanshumaity6780
@priyanshumaity6780 2 ай бұрын
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)
@yuryak3551
@yuryak3551 3 жыл бұрын
Thank you very much for the video, you helped me a lot
@mighell__
@mighell__ 3 жыл бұрын
thank you man you saved my night
@Sklyvan
@Sklyvan 3 жыл бұрын
def XOR(self, X, Y): return int(X != Y)
@naturfagstoff
@naturfagstoff 4 жыл бұрын
Excellent videos, very helpful. I will be using this in a course I am currently taking i Norway. Could You possibly also cover inputText boxes and especially validating input? Also: Is there a way to separate the actual coding from the QtDesigner code, so that the over-writing could be eliminated? I must say I am in awe for Your knowledge and ability to present and explain all the nits and grits of this topic. I went from being a total nerd on gui programming in python to starting to master it in just half a day. Thank You very much, and keep up the good work. Kudos!
@briangicharu2899
@briangicharu2899 3 жыл бұрын
Thanks man you just saved me a headache
@ashish2099
@ashish2099 Жыл бұрын
Thank you brother. God bless you
@romanthchowan1578
@romanthchowan1578 5 жыл бұрын
please make tutorial on Layouts in detail i love your videos
@preedapayattakool7512
@preedapayattakool7512 4 жыл бұрын
this is very great video , it pretty clear explanation , do u plan to have any python with QML ? really looking forward and million thx
@ainpe
@ainpe 4 жыл бұрын
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.
@sayanghosh6996
@sayanghosh6996 3 жыл бұрын
you can just do xor = x ^ y python (like all programming languages) has xor operator built in
@AliTwaij
@AliTwaij 2 жыл бұрын
Brilliant Thankyou
@Guitarluke13
@Guitarluke13 4 жыл бұрын
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?
@aditipathak9621
@aditipathak9621 4 жыл бұрын
nice tut sir
@KirtiSoni12
@KirtiSoni12 4 жыл бұрын
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.
@cunninghamb505
@cunninghamb505 5 жыл бұрын
Is there a way to change the style to fusion in qt5
@javiporras3396
@javiporras3396 4 жыл бұрын
great video
@Daniel-nn8oy
@Daniel-nn8oy 4 жыл бұрын
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?
@MarceloSilva-rv7sm
@MarceloSilva-rv7sm 3 жыл бұрын
Muito obrigado!
@bekirkagankaraahmetoglu4343
@bekirkagankaraahmetoglu4343 5 жыл бұрын
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.
@mohitarora1701
@mohitarora1701 3 жыл бұрын
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.
@thomasbrocherie7543
@thomasbrocherie7543 5 жыл бұрын
Can you show us how to get keyboard input?
@lolko211
@lolko211 4 жыл бұрын
Thanks
@meltpoolmartin772
@meltpoolmartin772 5 жыл бұрын
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
@atharvakadlag1937
@atharvakadlag1937 4 жыл бұрын
I spent 3 hours finding that functions yesterday!
@abdulhaseeb4980
@abdulhaseeb4980 Жыл бұрын
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?
@pavanmacherla1295
@pavanmacherla1295 3 жыл бұрын
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?
@sayyedrizwanali
@sayyedrizwanali 2 жыл бұрын
in line 67 command has changed in new version "submit" is replaced by "pushButton"
@one-word-edu
@one-word-edu 2 жыл бұрын
Hello.. How can I add multiple columns to a ComboBox and hide some of them ?
@chinaguy101
@chinaguy101 3 жыл бұрын
great!
@user-px4pk2wd4s
@user-px4pk2wd4s 5 жыл бұрын
You can pls make a gui tutorial with tkinter or other module
@maryam7221
@maryam7221 Жыл бұрын
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.
@faisal3560
@faisal3560 5 жыл бұрын
How to populate it from SQL?
@sainco3036
@sainco3036 5 жыл бұрын
thanks.
@iaggocapitanio7909
@iaggocapitanio7909 4 жыл бұрын
Very nice, but will be also very nice if there is a more deep approach
@QuarktaschemitSenf
@QuarktaschemitSenf Жыл бұрын
Hey Tim mine just works one time although i implemented the code at the exact same place. Any ideas?
@aryanbhatia6992
@aryanbhatia6992 5 жыл бұрын
Will you be making a big project in this series ??
@plouf1969
@plouf1969 3 жыл бұрын
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.
@tanmaypatel4152
@tanmaypatel4152 2 жыл бұрын
Man this is a really great idea. I owe you man!
@lucasmancini1283
@lucasmancini1283 2 жыл бұрын
I thought the same as you and basically solved it like this
@Tamer_Gomaa
@Tamer_Gomaa 3 жыл бұрын
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
@sanjeevkrishnaa2672
@sanjeevkrishnaa2672 3 жыл бұрын
just saying, i am pretty sure he wouldn't reply to questions in a year old video
@d-shiri
@d-shiri 3 жыл бұрын
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))
@abdullahsaid8561
@abdullahsaid8561 4 жыл бұрын
why not use bool()?
@fdffefegtetrtrg8445
@fdffefegtetrtrg8445 Ай бұрын
The program says to me . Why?
@thxyves8468
@thxyves8468 3 жыл бұрын
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
@fdffefegtetrtrg8445
@fdffefegtetrtrg8445 Ай бұрын
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.
@Dylanfire2
@Dylanfire2 3 жыл бұрын
has anyone found any other good Qt tutorial thats complete?
@bysantin
@bysantin 4 жыл бұрын
maybe str(bool(xor))?
@alexandarjelenic2880
@alexandarjelenic2880 5 жыл бұрын
Tim, please consider loading the . ui files within the .py. instead of converting them.
@hariharanm6705
@hariharanm6705 3 жыл бұрын
how to do that?
@stefanjovanovic3382
@stefanjovanovic3382 4 жыл бұрын
cant you just make variable xor a boolean and then it would always return True/False
@bibohahah2079
@bibohahah2079 4 жыл бұрын
def pressed(self): num1 = int(self.comboX.currentText()) num2 = int(self.comboY.currentText()) result = num1 ^ num2 self.label.setText(f"{num1} XOR {num2} = {result}")
@edouardbai1031
@edouardbai1031 3 жыл бұрын
I used the exact same commands, how come I cannot get error: name 'pressed' is not defined.
@edouardbai1031
@edouardbai1031 3 жыл бұрын
Oh, shoot. It is (self.pressed) instead of (self,pressed)
@edouardbai1031
@edouardbai1031 3 жыл бұрын
Now, cannot find reference 'connect' in 'function'. What should I do?
@edouardbai1031
@edouardbai1031 3 жыл бұрын
Also, x = int(...) has error: Invalid Literal for int() with base 10:' '
@muni3131
@muni3131 3 жыл бұрын
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.
@user-cj3yu9nv1u
@user-cj3yu9nv1u 4 жыл бұрын
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.
@user-cj3yu9nv1u
@user-cj3yu9nv1u 4 жыл бұрын
Sorry, I accidentally repeated the post.
@barunbasnet
@barunbasnet 4 жыл бұрын
You could have just used the Boolean operator '^' for XOR operation in the python instead.
@JasonLee-pr4sx
@JasonLee-pr4sx 2 ай бұрын
why not just xor=x^y ?
@johnz0rxxx
@johnz0rxxx 2 жыл бұрын
nice nice
@cemrek.
@cemrek. 4 жыл бұрын
you are god
@navneetsrivastava688
@navneetsrivastava688 Жыл бұрын
Can you just make a tutorial on pyqt5 threading
@Aeztrest
@Aeztrest 5 жыл бұрын
hi Tim! i really Enjoy your videos plz heart
@TechWithTim
@TechWithTim 5 жыл бұрын
I got you ;)
@arbazkhan8320
@arbazkhan8320 5 жыл бұрын
tim both 35% and 50% are 79$ why is it so?
@TechWithTim
@TechWithTim 5 жыл бұрын
You need to use the discount code at checkout
@rmgburke
@rmgburke 5 жыл бұрын
At kzbin.info/www/bejne/maOth62ZaqinldU 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.
@user-gu7ss6dc5e
@user-gu7ss6dc5e Жыл бұрын
Нормально, нормально
@JonSnyderfudge
@JonSnyderfudge Жыл бұрын
For anyone wondering, Python has an xor operator using "^" Don't do what this guy did.
@Trubripes
@Trubripes 3 жыл бұрын
XOR(x,y) = x!=y
@roberts1849
@roberts1849 3 жыл бұрын
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.
@vsp540
@vsp540 4 жыл бұрын
No reason to use: "xor = (x and not y) or (not x and y)" just use: "xor = x ^ y"
@user-cj3yu9nv1u
@user-cj3yu9nv1u 4 жыл бұрын
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.
@MiskoKatua
@MiskoKatua 3 жыл бұрын
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.
PyQt5 Tutorial - Containers (GroupBoxes and Frames)
6:24
Tech With Tim
Рет қаралды 107 М.
Create Stunning Python GUIs in 10 Minutes With Drag & Drop
11:38
Coding Is Fun
Рет қаралды 42 М.
哈莉奎因以为小丑不爱她了#joker #cosplay #Harriet Quinn
00:22
佐助与鸣人
Рет қаралды 8 МЛН
Inside Out Babies (Inside Out Animation)
00:21
FASH
Рет қаралды 23 МЛН
Fast and Furious: New Zealand 🚗
00:29
How Ridiculous
Рет қаралды 45 МЛН
The Truth About Learning Python in 2024
13:05
Tech With Tim
Рет қаралды 46 М.
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 392 М.
Creating Your Own Qt Applications...It's Easy!
15:27
DistroTube
Рет қаралды 36 М.
PyQt5 Tutorial - QMessageBox and Popup Windows
9:13
Tech With Tim
Рет қаралды 151 М.
25 Nooby Pandas Coding Mistakes You Should NEVER make.
11:30
Rob Mulla
Рет қаралды 265 М.
JPEG is Dying - And that's a bad thing
8:09
2kliksphilip
Рет қаралды 70 М.
Why Do Bubbles Form In Glasses Of Water?
12:33
Joe Scott
Рет қаралды 104 М.
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 114 М.
哈莉奎因以为小丑不爱她了#joker #cosplay #Harriet Quinn
00:22
佐助与鸣人
Рет қаралды 8 МЛН