我在用python。我正在使用pygtk编写一个程序,其中需要将多个pygtk对象(即hscale)移动一个设置的量(在另一个列表中-这里称为playStepList)。hscale在一个列表中,它们对应的“步骤”(每次执行移动的量)在playStepList中处于相同的索引中。每个HScale还有一个“开始”标记和一个“结束”标记。当hscale移动时,它们运行另一个函数。我希望所有hscale同时运行该函数,而不是让每个hscale都运行、完成,然后让列表中的下一个hscale运行。有什么办法让我这么做吗?我真的很感激你们提前给我的任何帮助。祝你好运!代码如下:
tempIndex = self.listOfPlayButtons.index(widget)
playStepList = []
if (self.listOfLockButtons[tempIndex].get_active()): # Indicates that the corresponding slider should be prepared to be moved by this function
for sliceAdjuster in self.listOfSliceAdjusters: # sliceAdjuster = hscale
secondIndex = self.listOfSliceAdjusters.index(sliceAdjuster)
playStepList.append(0.00)
if (self.listOfLockButtons[secondIndex].get_active()):
sliceAdjuster.set_value(self.listOfStartMarks[secondIndex]) # move the hscale to the start mark
playStepList[secondIndex] = (self.listOfEndMarks[secondIndex] - self.listOfStartMarks[secondIndex])/100
while (1 == 1):
for sliceAdjuster in self.listOfSliceAdjusters:
secondIndex = self.listOfSliceAdjusters.index(sliceAdjuster)
if (playStepList[secondIndex] != 0.00):
if (((sliceAdjuster.get_value() < self.listOfEndMarks[secondIndex]) and (playStepList[secondIndex] > 0.00)) or ((sliceAdjuster.get_value() > self.listOfEndMarks[secondIndex]) and (playStepList[secondIndex] < 0.00))):
sliceAdjuster.set_value(sliceAdjuster.get_value() + playStepList[secondIndex]
else:
return
大如果声明只是确保规模没有超过其终点。电子秤可以向左或向右移动,所以我需要检查两个方向。你知道吗
再次感谢你能提前给我的任何帮助!!你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐