import tkinter


def gui_input(prompt1, prompt2):
    """
    Creates a window to collect Risk and Budget info from user

    Parameters
    ----------
    prompt1 : String
        First question in input prompt
    prompt2 : String
        Second question in input prompt

    Returns
    -------
    value1 : String
        Value of response to the question asked in prompt1
    value2 : String
        Value of response to the question asked in prompt2

    """
    
    # create tkinterwindow and set title and geometry of window
    _root = tkinter.Tk()
    _root.title('Wolves of DK St - Options Strategy Visualization')
    _root.geometry("+600+400")

    # Set text for input screen
    tkinter.Label(_root, text='Welcome to the Options Strategy Visualization').grid(row=1, column=1, columnspan=2)
    tkinter.Label(_root, text='Enter your desired probability of profit:').grid(row=3, column=1, columnspan=2)
    tkinter.Label(_root, text=' ').grid(row=2, column=1, columnspan=2)
    tkinter.Label(_root, text='0.1 = 10% chance of profit (Throw your money away)').grid(row=4, column=1, columnspan=2)
    tkinter.Label(_root, text='0.5 = 50% chance of profit (gambling)').grid(row=5, column=1, columnspan=2)
    tkinter.Label(_root, text='0.9 = 90% chance of profit (high chance for profit)').grid(row=6, column=1, columnspan=2)
    tkinter.Label(_root, text=' ').grid(row=8, column=1, columnspan=2)
    tkinter.Label(_root, text='Enter your desired budget (number, min $2000)').grid(row=9, column=1, columnspan=2)
    tkinter.Label(_root, text='Please enter only numeric digits, no characters').grid(row=10, column=1, columnspan=2)
    tkinter.Label(_root, text=' ').grid(row=13, column=1, columnspan=2)
    
    # set prompt and input text; setup input collection to be saved to var1 and var2
    var1 = tkinter.StringVar()
    var2 = tkinter.StringVar()
    label1 = tkinter.Label(_root, text=prompt1)
    entry1 = tkinter.Entry(_root, textvariable=var1)
    label1.grid(row=7, column=1)
    entry1.grid(row=7, column=2)
    
    label2 = tkinter.Label(_root, text=prompt2)
    entry2 = tkinter.Entry(_root, textvariable=var2)
    label2.grid(row=12, column=1)
    entry2.grid(row=12, column=2)
    
    # create an "Enter" button to conclude data collection and exit GUI
    go = tkinter.Button(_root, text='Enter')#, command=store_data)
    go.grid(row=14, column=1, columnspan=2)
    go.bind("<Button-1>", lambda event: _root.destroy())

    # this will block main method from advancing until the window is destroyed
    _root.mainloop()

    # after the window has been destroyed, we can't access
    # the entry widget, but we _can_ access the associated
    # variable
    value1 = var1.get()
    value2 = var2.get()
    
    return value1, value2