2014-12-16, 22:28
Hi guys
I need your help, I'm writing a script that I want to fetch for each button controls when I stored the list of buttons in the arrays using append method.
So when I try this:
It will not fetch for every button controls as i'm getting an error:
Here is the full code:
I'm trying to find out how I can fetch for each button controls before I could move them.
Does anyone know how I can fetch for every button controls so I could move them?
I need your help, I'm writing a script that I want to fetch for each button controls when I stored the list of buttons in the arrays using append method.
So when I try this:
Code:
if programs_width >= 181:
for elem in self.program_buttons:
position_x = self.program_buttons[elem.control][self.channels_Index].getX()
position_y = self.program_buttons[elem.control][self.channels_Index].getY()
self.program_buttons[elem.control][self.channels_Index].setPosition(position_x, position_y - 342)
It will not fetch for every button controls as i'm getting an error:
Code:
position_x = self.program_buttons[elem.control][self.channels_Index].getX()
AttributeError: 'list' object has no attribute 'control'
Here is the full code:
Code:
def GoRight(self):
basex, basey = self.getControl(4207 + self.channels_Index).getPosition()
basew = self.getControl(4207 + self.channels_Index).getWidth()
# change program controls to display the proper junks
if self.channels_Index == len(self.program_buttons[self.programs_Index]) - 1:
CurrentRow = self.program_buttons[self.programs_Index][self.channels_Index].getX()
pixel_end = 1073
#Check on pixels size between start and end time
if CurrentRow < pixel_end:
programs_width = self.program_buttons[self.programs_Index][self.channels_Index].getWidth()
#left, top = self.program_buttons[self.programs_Index][self.channels_Index].getPosition()
#left = left - basex
#print left
#starttime = self.showTime + (left / (basew / 5400.0))
#self.setChannelButtons(self.shownTime + 1800, self.centerChannel)
#currentbutton_index = self.findButtonAtTime(self.programs_Index, starttime + 30)
#if(currentbutton_index + 1) < len(self.program_buttons[self.programs_Index]):
#self.channels_Index = currentbutton_index + 1
#else:
#self.channels_Index = len(self.program_buttons[self.programs_Index]) - 1
if programs_width <= 0.:
pass
#hide the button
else:
self.programs_Index += 1
else:
programs_width = self.program_buttons[self.programs_Index][self.channels_Index].getWidth()
if programs_width >= 181:
for elem in self.program_buttons:
position_x = self.program_buttons[elem.control][self.channels_Index].getX()
position_y = self.program_buttons[elem.control][self.channels_Index].getY()
self.program_buttons[elem.control][self.channels_Index].setPosition(position_x, position_y - 342)
#left = left - basex
#starttime = self.shownTime + (left / (basew / 5400.0))
#endtime = starttime + (width / (basew / 5400.0))
self.setFocus(self.program_buttons[self.programs_Index][self.channels_Index])
I'm trying to find out how I can fetch for each button controls before I could move them.
Does anyone know how I can fetch for every button controls so I could move them?