I'm using this question as a reference for how to structure a Tkinter class, but when I run the program and answer the pop-up dialog I create, the root window automatically closes.
from tkinter import *
from tkinter import simpledialog as sd
from datetime import datetime, date
import time
import pyowm as owm
# access API key
owm = foo
COUNTRY = 'US'
class App(Tk):
def __init__(self):
# create window and set size
self.root = Tk()
self.root.title("Weatherman")
self.root.geometry('700x200')
# get location
self.location = sd.askstring("Input","What's your location? Format as City, Country",parent=self.root)
self.location.strip()
# get date and time
current_date = StringVar()
current_date.set(date.today)
# debug label to check variable
self.test_label = Label(self.root,text=current_date.get())
self.test_label.pack()
def main():
app = App()
app.mainloop
if __name__ == '__main__':
main()