当按下按钮时具有从函数返回的值

时间:2019-11-29 09:42:13

标签: python button tkinter

我正在编写一个代码,当按下按钮时,该代码返回从其他列表小部件中选择的项目列表 但是当我尝试在其他功能中使用此本地列表时,我无法 在此代码中无法打印更新的“ c”

nby = ttk.Notebook(self.master)
nby.place(x=0,y=15)
page3 = ttk.Frame(nby)
nby.add(page3, text='Liste des DID')
p1_Include = Listbox(page3)
p1_Include.configure(selectmode=MULTIPLE, width=9, height=50)
p1_Include.grid(row=0, column=0)
a,b=avoir_file()
print("edd",a)
print("gh",b)
new_list = b
for langy in new_list:
    p1_Include.insert(END, langy)

def combine_funcs(*funcs):
    def combined_func(*args, **kwargs):
        for f in funcs:
            f(*args, **kwargs)
    return combined_func


def get_selectiony():
    items=[]
    items = [new_list[int(item)] for item in  p1_Include.curselection()]
    print("ezzeez",items)
    p=items
    return p

c=get_selectiony()
#        print("zzzz==",c)           
btnGet3 = Button(page3,text="Get Select DID",command=lambda:[get_selectiony(),print("dd",c)])
btnGet3.grid() 

0 个答案:

没有答案