Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # checks demographics
- def demogCheck():
- defaultFont = QFont("Tahoma", 13)
- boldFont = QFont("Tahoma", 13)
- boldFont.setBold(True)
- isInformationCorrect = True
- # checking age, if 0 - participant hasn't put age in, if under 18, tells them they are too young to take part
- # if over 18 then continue to next page
- if window.spinboxAge.value() == 0:
- window.labelAge.setFont(boldFont)
- window.errorAgeUnder18.hide()
- window.errorAge.show()
- isInformationCorrect = False
- elif window.spinboxAge.value() < 18:
- window.labelAge.setFont(boldFont)
- window.errorAge.hide()
- window.errorAgeUnder18.show()
- isInformationCorrect = False
- else:
- window.labelAge.setFont(defaultFont)
- window.errorAgeUnder18.hide()
- window.errorAge.hide()
- # checking if participant has selected any of the gender options, can only continue if an option is checked
- if (not window.buttonFemale.isChecked()) and (not window.buttonMale.isChecked()) and (not window.buttonOtherGender.isChecked()):
- window.labelGender.setFont(boldFont)
- window.errorGender.show()
- isInformationCorrect = False
- else:
- window.labelGender.setFont(defaultFont)
- window.errorGender.hide()
- # checking if participant has input an ethnicity, can only continue if text has been written in
- if window.lineeditEthnicity.text() == '':
- window.labelEthnicity.setFont(boldFont)
- window.errorEthnicity.show()
- isInformationCorrect = False
- else:
- window.labelEthnicity.setFont(defaultFont)
- window.errorEthnicity.hide()
- # checking if participant has selected one of the education options, can only continue if the index is not 0
- if window.comboEducation.currentIndex() == 0:
- window.labelEducation.setFont(boldFont)
- window.errorEducation.show()
- isInformationCorrect = False
- else:
- window.labelEducation.setFont(defaultFont)
- window.errorEducation.hide()
- # if all the demographics are filled in, taken to next page of stacked widget
- if isInformationCorrect:
- nextPage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement