The quick version: I'm trying to figure out how to pass either a list or tuple from a function in one script, to a function in another script. The issue I run into, is that it always becomes a NoneObjectType in the second script, and then I can't do anything with it other than print it out as a long string.
The long version: I use a 3d program called Poser, that allows the use of Python to auto mate tasks. Because of this I made a nice little script called SelectMultiple that gives me a nice wxPython window were I can choose the items I want to modify. Because I can see using this over and over, I wanted it to be it's own script.
Here is the function I'm calling from SelectMultiple:
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(false);
}
}
by default selected is a tuple, as you can see I tried casting it as a list before returning it, but it doesn't show up that way in my other script. The file does import, and I can print it and get a string that shows the content, but it's always NoneType and I can't do much with it. Here's the script I'm calling from:
def MyApp():
title = "Select from list"
# Make the selection window pop up
mydialog = userInput(title, lst)
popupwindow = mydialog.ShowModal()
# If the user cancels win = 0
if popupwindow == wx.ID_CANCEL:
print "User canceled"
return
# Get the selected actors
selected = mydialog.GetSelectedActors()
# We are finished with the dialog
mydialog.Destroy()
return lst(selected)
So yeah, how do I get something other than a NoneType back.
答案 0 :(得分:0)
所以我用拼写错误创建了自己的问题。在我发现选中不是列表而是元组之后,我错误地将列表转换为lst,然后无法弄清楚为什么它不是列表。谢谢你的帮助
答案 1 :(得分:-2)
循环通过selected
元组并将项目添加到列表中。
l = list()
for item in selected:
l.append(item)
return l
此外,我不确定您使用的是哪个版本的Python,但列表的强制转换为list()
而不是lst()