'nonetype' Object Has No Attribute 'text' In Tablewidgets
I was trying to work with TableWidgets on Python and I ran into an issue. I wanted to check whether the table is filled or not (with str of course). def add_table (self): self.
Solution 1:
It seems that the table widget might contain 'None' values, so you have to expect them to pop up. Instead of doing this:
ifself.tableWidget.item(i,0).text() != '':
do that:
thing = self.tableWidget.item(i,0)
if thing isnotNoneand thing.text() != '':
# do stuff with thing
Post a Comment for "'nonetype' Object Has No Attribute 'text' In Tablewidgets"