Python Forum

Full Version: Not able to use the output from one function into another function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Team,

print("YOU_SELECTED"+Region)line in below code is not coming. Please help me with this




from tkinter import *
def drop_dwn():
    OPTIONS = ["DEV","LB","ST"] #etc

    master = Tk()

    variable = StringVar(master)
    variable.set("Select_the_Regions") # default value

    w = OptionMenu(master, variable, *OPTIONS)
    w.pack()

    def ok():
        global Region
        print ("value is:" + variable.get())
        Region=variable.get()
        master.destroy()

    button = Button(master, text="OK", command=ok)
    button.pack()

    mainloop()
def Run_in_soap():
    drop_dwn()
    print("YOU_SELECTED"+Region)  
  
# create a tkinter window 
root = Tk()               
  
# Open window having dimension 100x100 
root.geometry('100x100')  
  
# Create a Button 
btn = Button(root, text = 'Click me !', bd = '5', 
                          command = Run_in_soap)  
  
# Set the position of button on the top of window.    
btn.pack(side = 'top')     
  
root.mainloop()
Where do you want to show this line "print("YOU_SELECTED"+Region" ?