Disabling QComboBox in pyqt

偶尔善良 提交于 2019-12-23 10:54:18

问题


Is it possible to disable QComboBox in pyqt like we can do it in Win Forms(C#) since I could not find any option in the QComboBox manual. I want to enable QcomboBox only when admin logins.


回答1:


I found the answer to my question,

QComboBox.setEnabled(False) # disable comboBox

and

QComboBox.setEnabled(True) # enable comboBox 



回答2:


You can also do :

QComboBox.setDisabled(True)
QComboBox.setDisabled(False)


来源:https://stackoverflow.com/questions/20468602/disabling-qcombobox-in-pyqt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!