To add a border to a non-editable QComboBox in PyQt5, you can use the QComboBox's stylesheet. By default, the non-editable QComboBox does not have an input box that's visually similar to other input widgets like QLineEdit. To emphasize the widget's boundary, you can set a border using stylesheets.
Here's a simple example of how to add a border to a non-editable QComboBox:
import sys from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QComboBox class App(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): layout = QVBoxLayout() combo = QComboBox(self) combo.addItems(['Option 1', 'Option 2', 'Option 3']) # Setting the combo box to non-editable combo.setEditable(False) # Adding a border using a stylesheet combo.setStyleSheet("QComboBox { border: 2px solid gray; }") layout.addWidget(combo) self.setLayout(layout) self.setWindowTitle('ComboBox Border') self.show() if __name__ == '__main__': app = QApplication(sys.argv) ex = App() sys.exit(app.exec_()) In this example, the setStyleSheet method is used to set a border of 2 pixels with the color gray around the QComboBox. You can adjust the styles (such as border width, style, color, etc.) according to your needs by modifying the stylesheet string.
cypress icons server-side-rendering android-selector language-theory angular7-router stage ssis-2012 raspberry-pi2 domain-name