python error: TypeError: an integer is required
python error: TypeError: an integer is required
The problem is that programs_width
is a list.
programs_width = list()
If none of these if
statements
if prog_width == 342:
programs_width = 181
#1 hour
if prog_width == 691:
programs_width = 181
trigger, then programs_width
will still be a list here:
self.getControl(prog_ids).setWidth(programs_width)
which causes an error.
Your quotes are making these values strings, not integers. Remove the quotes on your values. In addition, the error message clearly indicates the bad line:
self.getControl(str(prog_ids)).setWidth(str(programs_width))
Notice that you are explicitly converting the parameter to a string with str. Use int, instead:
self.getControl(str(prog_ids)).setWidth(int(programs_width))
… or omit the conversion altogeher if you know the input is already an integer.