Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. # checks demographics
  2. def demogCheck():
  3. defaultFont = QFont("Tahoma", 13)
  4. boldFont = QFont("Tahoma", 13)
  5. boldFont.setBold(True)
  6.  
  7. isInformationCorrect = True
  8. # checking age, if 0 - participant hasn't put age in, if under 18, tells them they are too young to take part
  9. # if over 18 then continue to next page
  10. if window.spinboxAge.value() == 0:
  11. window.labelAge.setFont(boldFont)
  12. window.errorAgeUnder18.hide()
  13. window.errorAge.show()
  14. isInformationCorrect = False
  15. elif window.spinboxAge.value() < 18:
  16. window.labelAge.setFont(boldFont)
  17. window.errorAge.hide()
  18. window.errorAgeUnder18.show()
  19. isInformationCorrect = False
  20. else:
  21. window.labelAge.setFont(defaultFont)
  22. window.errorAgeUnder18.hide()
  23. window.errorAge.hide()
  24. # checking if participant has selected any of the gender options, can only continue if an option is checked
  25. if (not window.buttonFemale.isChecked()) and (not window.buttonMale.isChecked()) and (not window.buttonOtherGender.isChecked()):
  26. window.labelGender.setFont(boldFont)
  27. window.errorGender.show()
  28. isInformationCorrect = False
  29. else:
  30. window.labelGender.setFont(defaultFont)
  31. window.errorGender.hide()
  32. # checking if participant has input an ethnicity, can only continue if text has been written in
  33. if window.lineeditEthnicity.text() == '':
  34. window.labelEthnicity.setFont(boldFont)
  35. window.errorEthnicity.show()
  36. isInformationCorrect = False
  37. else:
  38. window.labelEthnicity.setFont(defaultFont)
  39. window.errorEthnicity.hide()
  40. # checking if participant has selected one of the education options, can only continue if the index is not 0
  41. if window.comboEducation.currentIndex() == 0:
  42. window.labelEducation.setFont(boldFont)
  43. window.errorEducation.show()
  44. isInformationCorrect = False
  45. else:
  46. window.labelEducation.setFont(defaultFont)
  47. window.errorEducation.hide()
  48. # if all the demographics are filled in, taken to next page of stacked widget
  49. if isInformationCorrect:
  50. nextPage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement