我正在为一个CFD可视化程序编写一个脚本,它与python有接口。 我创建了一个通用对话框,用户可以在其中输入一些值。现在,如果输入为false(这意味着一个变量大于另一个变量),我想重复该对话框:
items = []
items.append(['text',ITEM_TEXT,"Automatically save the evaluation in data file(s)\n",""])
items.append(['text',ITEM_TEXT,"Determine the range of timesteps that you want to save:",""])
items.append(['step_begin',ITEM_INT,"Start timestep:","Start timestep",first_step,first_step,timesteps])
items.append(['step_end',ITEM_INT,"End timestep:","End timestep",timesteps,first_step,timesteps])
a = CeiQtGenericDialog(items,None,"Save evaluation","Ok","Cancel")
ret = a.doit()
if (ret > 0):
for i in a.getValues():
if (i=='step_begin'):
begin = a.getValue(i)
if (i=='step_end'):
end = a.getValue(i)
if (begin > end):
items2 = []
items2.append(['text',ITEM_TEXT,"Start timestep must be smaller than end timestep!!",""])
a = CeiQtGenericDialog(items2,None,"Error","Ok","Cancel")
ret = a.doit()
if (ret > 0):
????
在a.getValues()
中,前面存储了泛型对话框的值。现在在最后,如果我想跳回到以前的通用对话框。换句话说,我想重复从某一行开始的代码,这样用户就可以在通用对话框中重复输入“step_begin”和“step_end”,这怎么可能?在
编辑/ 如果用户在通用对话框中单击“确定”,则ret将获得值1;如果用户单击“取消”,则ret将获得值0
我将使用while循环,如下所示:
我认为你应该把这一部分重复一遍,而你却没有得到预期的结果
相关问题 更多 >
编程相关推荐