user interface – How do I transfer input and output for my function from the console to my GUI app?

I’m not sure how to transfer the input and output of my function from the console to the interface. I don’t know if I should do the destroy function and create a new frame each time.

from tkinter import *

states = ("Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho",
          "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi",
          "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio",
          "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia",
          "Washington", "West Virginia", "Wisconsin", "Wyoming")
capitals = ("Montgomery", "Juneau", "Phoenix", "Little Rock", "Sacramento", "Denver", "Hartford", "Dover", "Tallahassee", "Atlanta", "Honolulu", "Boise",
            "Springfield", "Indianapolis", "Des Moines", "Topeka", "Frankfurt", "Baton Rouge", "Augusta", "Annapolis", "Boston", "Lansing", "St. Paul", "Jackson",
            "Jefferson City", "Helena", "Lincoln", "Carson City", "Concord", "Trenton", "Santa Fe", "Albany", "Raleigh", "Bismarck", "Columbus",
            "Oklahoma City", "Salem", "Harrisburg", "Providence", "Columbia", "Pierre", "Nashville", "Austin", "Salt Lake City", "Montpelier", "Richmond",
            "Olympia", "Charleston", "Madison", "Cheyenne")

def geofunction():
    i = 0
    for element in states:
        value = 1
        while value == 1:
            test = input(element + ": ") 
            if test == capitals(i):
                print("You got it!")
                value = 0
            else:
                print("Try again")
        i += 1
    print("Game Finished!")

root = Tk()

topFrame = Frame(root)
topFrame.pack()
bottomFrame = Frame(root)
bottomFrame.pack()

theLabel = Label(topFrame, text = "Welcome to the Geography Quizzer!nClick below to get started!")
theLabel.pack(fill=BOTH)

getstarted = Button(bottomFrame, text="Get started!", fg="black", bg="tan", command=geofunction)
getstarted.pack(fill=BOTH)

root.mainloop()