0

嘿伙计们,我的工作需要一些帮助,谢谢<3

所以基本上我有一个巨大的笔记本,我在其中启用了 jupyter 的小部件,以便读取用户引入的数据并执行一些操作。它正确读取并执行此操作,但是在我仍然必须使用这些数据进行操作之后...但是我必须在按钮单击选项之外再次读取它,我的代码是:

def on_button_clicked(b):
"""
This function reads the inputs introduced by the users and calls the function thing defined above to do the thing
"""
output.clear_output()


#data_processing



#button clicked
with output:
        #creation of A,B  rates list  
    A_variable = A_rates_input.value*0.01
    B_variable=[]
    for i in range(len(B_variable)):
        B_variable(B_variable[i].value*0.01)



#creation nominal A and initial currency change
    C = C.value
    D = D.value 

#Calculation of Nb_0
    E= C*D

#default values
    othervariable = [0.03, 0.025, 0.02, 0.015, 0.01 ]
    othervariable2 = [0.04, 0.035, 0.01, 0.005, 0.02 ]


#ccy_val  reading user imput
    otherrr = otherr.value

#read data
    other_variable = other_selection.value
    print(some action)
    #do things
   
display(button, output)
button.on_click(on_button_clicked)

所以问题是,在执行这个按钮之后,它会很好地读取数据并做我想做的事情,但是之后如果我尝试使用其中一些变量,它会说它们没有定义..当我如何保存它们时使用按钮?

4

0 回答 0