Python Forum
passing str from Callfunction to another Callfunction - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: passing str from Callfunction to another Callfunction (/thread-8176.html)



passing str from Callfunction to another Callfunction - issac_n - Feb-08-2018

I am trying to pass the str/path from a Callfunction to another Callfunction. First call function is trigger by a click button and keep the path with G , and I cant find a way to pass this str/path to another Callfunction. below is my code and try to pass it to function RUN. possible keep the str G in global , so that all other Callfunction can using same info?

inputformat = [("op1","op1"),("op2","op2"),("op3","op3")]
V = StringVar()
for text, mode in inputformat:
        b = Radiobutton(main, text = text, variable = V, value = mode)
        b.grid(column=4 )
def OpenFolder():     
        main1.filename = filedialog.askdirectory()
        G= os.path.normpath(main.filename)
        TryPassG = G
def RUN():
        optVal = V.get()
        if optVal == "op1": op1F()
        elif optVal == "op2": op2F()
        elif optVal == "op3": op3F()
Button(master1, text ="OpenFolder", command = OpenFolder,width=20).grid(column = 3,row=0,sticky='W')
Button(master1, text ="RUN", command = RUN,width=20).grid(column = 3,row=2,sticky='W')

i think i found the answer>> "global G" in function :)