2014-12-27, 21:03
Hi guys,
I need some help with my code issue, I'm trying to use the variable `prog_ids` to output each id in getControl and I'm also trying to use the variable `programs_width` to output each value in setWidth, but it give me the error: TypeError: an integer is required
The error are jumping on this line:
Here is the full code:
Here is the output for prog_ids:
Here is the output for programs_width:
The type of prog_ids is `str` and the type of programs_width is `int`
I have also tried this:
It give me the error: RuntimeError: Non-Existent Control 3072
The error are jumping on this line:
I have got no idea what the problem is. I have tried to do in few ways but it give me the same kind of problem.
Can you please help me how to fix the error that I'm getting to correct the problem?
Any advice would be greatly appreciated.
Thanks in advance.
I need some help with my code issue, I'm trying to use the variable `prog_ids` to output each id in getControl and I'm also trying to use the variable `programs_width` to output each value in setWidth, but it give me the error: TypeError: an integer is required
The error are jumping on this line:
Code:
self.getControl(prog_ids).setWidth(programs_width)
Here is the full code:
Code:
program_id = list()
program_width = list()
programs_width = list()
#create the rows for 69 program buttons
program_id.extend(range(3002, 3485))
program_id = map(str, program_id)
programs_width = map(str, programs_width)
#get the width for 69 program buttons
for elem in programs_button:
program_width.append(elem.getWidth())
program_width = map(str, program_width)
program_X = map(str, program_X)
for pos_X, prog_width, prog_ids in zip(program_X, program_width, program_id):
if int(pos_X) == 1073:
#30 mins
if int(prog_width) == 342:
programs_width = 181
#1 hour
elif int(prog_width) == 691:
programs_width = 181
#1 hour and 30 mins
elif int(prog_width) == 1033:
programs_width = 181
#2 hours
elif int(prog_width) == 1382:
programs_width = 181
#2 hours and 30 mins
elif int(prog_width) == 1724:
programs_width = 181
#3 hours
elif int(prog_width) == 2073:
programs_width = 181
#3 hours and 30 mins
elif int(prog_width) == 2415:
programs_width = 181
#4 hours
elif int(prog_width) == 2764:
programs_width = 181
#4 hours and 30 mins
elif int(prog_width) == 3106:
programs_width = 181
programs_width = int(prog_width)
test = int(prog_ids)
self.getControl(prog_ids).setWidth(programs_width)
#add the programs buttons
self.addControls(programs_button)
Here is the output for prog_ids:
Code:
18:56:18 T:4012 NOTICE: 3072
18:56:18 T:4012 NOTICE: 3211
18:56:18 T:4012 NOTICE: 3279
18:56:18 T:4012 NOTICE: 3348
18:56:18 T:4012 NOTICE: 3417
Here is the output for programs_width:
Code:
18:58:04 T:5400 NOTICE: 181
18:58:04 T:5400 NOTICE: 181
18:58:04 T:5400 NOTICE: 181
18:58:04 T:5400 NOTICE: 181
18:58:04 T:5400 NOTICE: 181
The type of prog_ids is `str` and the type of programs_width is `int`
I have also tried this:
Code:
programs_width = int(prog_width)
test = int(prog_ids)
#print type(test)
self.getControl(test).setWidth(programs_width)
It give me the error: RuntimeError: Non-Existent Control 3072
The error are jumping on this line:
Code:
self.getControl(test).setWidth(programs_width)
I have got no idea what the problem is. I have tried to do in few ways but it give me the same kind of problem.
Can you please help me how to fix the error that I'm getting to correct the problem?
Any advice would be greatly appreciated.
Thanks in advance.