python 2.7 - How to search for a specific kind of qt gui control -
python 2.7 - How to search for a specific kind of qt gui control -
i have qwidget contains qgroupbox, contains qcombobox, qlineedit , qcheckbox.
i need go around controls, , if command qcheckbox, inquire if checked or not. need know how qcheckbox checked - thought this:
count = 0 command in groupbox.controls(): if command type of qtgui.qcheckbox: if control.ischecked: count = count + 1 else: print('no checked') else: print('no qtgui.qcheckbox') print ('there '+ str(count)+ 'checked')
if checkboxes children of groupbox, can seek this:
count = 0 checkbox in groupbox.findchildren(qtgui.qcheckbox): if checkbox.ischecked(): count += 1 print('there %s checked' % count) the checkboxes children of groupbox if created this:
checkbox = qtgui.qcheckbox('title', groupbox) python-2.7 pyqt iteration state qcheckbox
Comments
Post a Comment