Hi guys
I need a bit of your help. I've created the variables that I want to store a list of arrays outside the for loop. I have got a problem with the code that I currently using.
When I try this:
import xbmc
import xbmcgui
import xbmcaddon
class ProgramControls(object):
def __init__(self, control, program):
self.control = control
self.program = program
class MyClass(xbmcgui.WindowXML):
def __init__(self):
self.program_buttons = list()
self.button_focus = 'programs_yellow.png'
self.button_nofocus = 'channels_bar1.png'
program_controls = xbmcgui.ControlButton(
int(position_start),
int(position_top),
int(program_width),
int(program_height),
program_title,
focusTexture = path + self.button_focus,
noFocusTexture = path + self.button_nofocus,
textColor ='0xFFFFFFFF',
focusedColor ='0xFF000000'
)
self.program_buttons.append(ProgramControls(program_controls, program))
programs_button = [elem.control for elem in self.program_buttons]
program_id = list()
program_width = list()
for elem in programs_button:
program_id = elem.getId()
print program_id
self.addcontrols(programs_button)
It will give me the error: AttributeError: 'MyClass' object has no attribute 'programs_button'
The error are jumping on this line:
for elem in self.programs_button:
Can you please help me how I can fix this?