Aug-04-2017, 12:36 AM
Hi all,
I am working on my code as I am calculating with the button width size and the pixel in the area of the X in the screen to add it together to get the value. I'm trying to compare the value with the list when I'm calculating them to see if the value would come close, higher or equal to in the list.
Here is the code:
How I could do that using with my code?
Thanks in advance!
I am working on my code as I am calculating with the button width size and the pixel in the area of the X in the screen to add it together to get the value. I'm trying to compare the value with the list when I'm calculating them to see if the value would come close, higher or equal to in the list.
Here is the code:
CurrentRows = [375, 441, 507, 559, 610, 669, 724, 790, 838, 844, 849, 897, 910, 949, 959, 1009, 1016, 1018, 1019, 1072, 1125, 1138, 1184, 1186, 1189, 1238, 1246, 1286, 1419, 1620, 1762, 1840, 1943] nextprogram = int(program_id) + 1 nextprogram1 = int(nextprogram) + 1 nextprogram2 = int(nextprogram1) + 1 nextprogram3 = int(nextprogram2) + 1 program_button_1 = self.getControl(int(program_id)) program_button_2 = self.getControl(int(nextprogram)) program_button_3 = self.getControl(int(nextprogram1)) program_button_4 = self.getControl(int(nextprogram2)) pos_X = program_button_1.getX() width = program_button_1.getWidth() pos2_X = pos_X + width + 5 print "program2 posX............................" print pos2_X program_button_2.setPosition(pos2_X, pos_Y) for pos_X1 in CurrentRows: if pos_X1 >= pos_X: pos_X = pos_X1 break width = program_button_2.getWidth() pos3_X = pos2_X + width + 5 print "program3 posX............................" print pos3_X program_button_3.setPosition(pos3_X, pos_Y)When the variable
pos_X
show the value 1194
, the closest one would be 1184
. It is because 1194
went over 1184
so 1184
would be the correct value that I would use. If the value show 1253
, the closest one would be 1246
. When the value show 1125
that are matched from the list, I want to get 1125
from the list. How I could do that using with my code?
Thanks in advance!