Hi all,
I need some help with my code. I have a problem with running the code through on the loop because when I pressed on the right arrow button of the keyboard, it will make my code executing like twice.
Example: I have got two buttons with two different button size which it is 691 and 167. The variables I use which it have a button size 691 and nextprogram_width have a button size 167. I want to check the button size 691 using with program_width when I checking with the program id under the loop. I have changed the button size from 691 to 344, but on my code it will executed and changed the button size from 691 to 344 and then changed it from 344 to 167. I only want to change the button size from 691 to 344 not to 167.
When I try this:
I have tried to use the if and elif statement to try to block the code from executed twice, but it didn't help.
How I can block the code from executed twice to stop the button size from changed twice when I want to change the button size as only once when I use to call the GoRight function at once a time?
I need some help with my code. I have a problem with running the code through on the loop because when I pressed on the right arrow button of the keyboard, it will make my code executing like twice.

Example: I have got two buttons with two different button size which it is 691 and 167. The variables I use which it have a button size 691 and nextprogram_width have a button size 167. I want to check the button size 691 using with program_width when I checking with the program id under the loop. I have changed the button size from 691 to 344, but on my code it will executed and changed the button size from 691 to 344 and then changed it from 344 to 167. I only want to change the button size from 691 to 344 not to 167.
When I try this:
ACTION_MOVE_RIGHT = 2 def onAction(self, action): if action == ACTION_MOVE_Right: if allchannels_enabled: if self.channels_Index != len(self.program_buttons) - 1: self.GoRight() def GoRight(self): for program_id in self.program_id: program_width = self.getControl(int(program_id)).getWidth() programX = self.getControl(int(program_id)).getX() if int(programX) == 375 and int(program_width) == 691: programs_width = 344 self.getControl(int(program_id)).setWidth(int(programs_width)) program_width = self.getControl(int(program_id)).getWidth() elif int(programX) == 375 and int(program_width) == 167: print "you are working on 167 button" self.getControl(int(program_id)).setLabel(nextprogram_label) self.getControl(int(program_id)).setWidth(nextprogram_width)When I pressed on the right arrow button of the keyboard, it will call the GoRight function and it will find the list of program id from the self.program_id list then find the button size I want to change before it will executed twice when I use to call the GoRight function only once a time. I can't be able to find out what the trouble is or where it is coming from. I believe the trouble is coming from either under the loop or the if statement that I did not write it correctly.
I have tried to use the if and elif statement to try to block the code from executed twice, but it didn't help.
How I can block the code from executed twice to stop the button size from changed twice when I want to change the button size as only once when I use to call the GoRight function at once a time?