问题是btn.onclicked(callback.next)
不会进入下一个循环,也不会得出下一个循环的点。请帮忙,我是python的新手
import matplotlib.pyplot as plt
import mdfreader
from matplotlib.widgets import Button
btn_next = plt.axes([0.78, 0.93, 0.06, 0.045])
bnext = Button(btn_next, 'Next -->', color='0.55', hovercolor='0.95')
class Index(object):
global_cycle = 0
def next(self, event):
self.global_cycle += 1
callback = Index()
# crossing on the 40 objects
for i in range(number_ohy_objects):
wExistProb = mdf_inf._getChannelData3('fus.ObjData_Qm_TC.FusObj.i' + str(i) + '.wExistProb')
dx_Ohl_Obj = mdf_inf._getChannelData3('fus.ObjData_Qm_TC.FusObj.i' + str(i) + '.dxv')
dy_Ohl_Obj = mdf_inf._getChannelData3('fus.ObjData_Qm_TC.FusObj.i' + str(i) + '.dyv')
# check the value bigger than 0.1 and add into a list
if wExistProb[global_cycle] > 0.1:
obj_index.append(i)
obj_dy.append(dy_Ohl_Obj[global_cycle])
obj_dx.append(dx_Ohl_Obj[global_cycle])
# plot the points
aux = plt.scatter(obj_dy[:], obj_dx[:], color='green')
bnext.on_clicked(callback.next)
aux = plt.scatter(obj_dy[global_cycle], obj_dx[global_cycle] color='green')
plt.show()