Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to set text in QComboBox pyqt5

# importing libraries
from PyQt5.QtWidgets import * 
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import * 
from PyQt5.QtCore import * 
import sys
  
  
class Window(QMainWindow):
  
    def __init__(self):
        super().__init__()
  
        # setting title
        self.setWindowTitle("Python ")
  
        # setting geometry
        self.setGeometry(100, 100, 600, 400)
  
        # calling method
        self.UiComponents()
  
        # showing all the widgets
        self.show()
  
    # method for widgets
    def UiComponents(self):
  
        # creating a combo box widget
        self.combo_box = QComboBox(self)
  
        # setting geometry of combo box
        self.combo_box.setGeometry(200, 150, 120, 30)
  
        # geek list
        geek_list = ["Geek", "Geeky Geek", "Legend Geek", "Ultra Legend Geek"]
  
        # adding list of items to combo box
        self.combo_box.addItems(geek_list)
  
        # item
        item ="Legend Geek"
  
        # setting current item
        self.combo_box.setCurrentText(item)
  
  
# create pyqt5 app
App = QApplication(sys.argv)
  
# create the instance of our Window
window = Window()
  
# start the app
sys.exit(App.exec())
Comment

PREVIOUS NEXT
Code Example
Python :: python adding values to existing key 
Python :: gwt height with tkinker 
Python :: sorting-a-python-list-by-two-fields 
Python :: how to send jobs to queue dynamically 
Python :: How to compress image field in django? 
Python :: ex: python 
Python :: wget download file python magic 
Python :: how to send one variable to python using xlwings 
Python :: fast guess for divisible numbers between two numbers 
Python :: u00a0 
Python :: featch detail of subscription in stripe api 
Python :: afkastiningsgrad 
Python :: delete row by index pandas 
Python :: generate 3 pages pdf reportlab 
Python :: python pycharm 
Python :: how to randomize words with pyautogui 
Python :: How to test if a webpage is an image python requests 
Python :: python debugger online 
Python :: convert an image to matrix in python 
Python :: what is proc file 
Python :: text to qr code python 
Python :: tkinter sin 
Python :: Pouring 8 litres into 2 empty container of size 3 and 5 to get 4 litre in any container 
Python :: Slice Age in Python 
Python :: Freqtrade - sell after x candels 
Python :: python warshall algorithm stackoverflow 
Python :: golng open file append 
Python :: requests session 
Python :: python range for loop 
Python :: string -1 python 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =