Python Forum
passing str from Callfunction to another Callfunction
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing str from Callfunction to another Callfunction
#1
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 :)
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020