def sort_domain():
if self.cb1.isChecked():
for line in f:
line= line.strip()
if line.endswith('.com') is True:
self.textBrowser.append(line)
else:
pass
elif not self.cb1.isChecked() and not self.cb2.isChecked():
for line in f:
line=line.strip()
self.textBrowser.append(line)
if self.cb2.isChecked():
for line in f:
line= line.strip()
if line.endswith('.net') is True:
self.textBrowser.append(line)
else:
pass
elif not self.cb1.isChecked() and not self.cb2.isChecked():
for line in f:
line=line.strip()
self.textBrowser.append(line)
self.btn2.clicked.connect(sort_domain)
If I checked cb1 and cb2 ((checkbox1 and chekbok2)) the results are all domains with extension .com only.
What is the correct way to write a function to show all Domains when you press the chekBox1 ".com" and chekBox2 ".net"?