Tkinter Python GUI Issues
Question: Below is my code, it runs but I'm not sure how to get the "Run text" button to
prompt me to open text file in new window, currently a new window appears with
a "Quit" button, nothing else.

    
    
    import tkFileDialog
    import Tkinter as tk
    from Tkinter import *
    import logging
    
     logging.basicConfig(filename= "log_file.txt", filemode = "w", level=logging.DEBUG, format='%(asctime)s %(message)s', datefmt='%d/%m/%Y %I:%M:%S %p')
    
    logging.warning('is when this event was logged.')
    
    class HomeScreen:
    def __init__(self, master):
        self.master = master
        self.frame = tk.Frame(self.master)
        self.button1 = tk.Button(self.frame, text = 'Run Text', width = 25, command = self.new_window)
        self.button1.pack()
        self.frame.pack()
    
    def openFile(self):
        openfile = tkFileDialog.askopenfile().read()
        text= open(openfile, 'r').read()
        T.insert(1.0, openfile)
        T = Text(height=10, width=100)
        T.pack()
        T.insert(END, "Select file to input")
        B = Button(root, text="Open", command=openFile)
        B.pack()
        mainloop()
        return
    
    def new_window(self):
        self.newWindow = tk.Toplevel(self.master)
        self.app = Quit(self.newWindow)
    
    class Quit:
    def __init__(self, master):
        self.master = master
        self.frame = tk.Frame(self.master)
        self.quitButton = tk.Button(self.frame, text = 'Quit', width = 25, command = self.close_windows)
        self.quitButton.pack()
        self.frame.pack()
    def close_windows(self):
        self.master.destroy()
    
    def main(): 
    root = tk.Tk()
    app = HomeScreen(root)
    app = Quit(root)
    root.mainloop()
    
    if __name__ == '__main__':
    main()
    

I'm sure my code is very messy as I'm just a beginner, some parts may not be
needed, any advice would be greatly appreciated.


Answer: If you want that `"Run text"` open's a file dialog change called method:

    
    
    self.button1 = tk.Button(self.frame, text = 'Run Text', width = 25, command = self.openFile)
    

