Ruddog icon

Delay in displaying GUI window?

Ruddog | PRO | 05/11/17 07:07:08 PM UTC | 0 ⭐ | 365 👁️ | Never ⏰ | []
Python |

1.16 KB

|

None

|

0 👍

/

0 👎

import shutil, os
from tkinter import *
root=Tk()
root.title("Text")
root.geometry("650x200")
sPath="c:/"
ext2Search4="txt"
"""
How do I get the window to display at start up as it is now
it will not display until after the def create_widgets(self): has
completed?
"""
    
class Application(Frame):
    def __init__(self,master):
        Frame.__init__(self,master)
        self.grid()
        self.create_widgets()
    def create_widgets(self):
        f = open("RedInFile.txt",'w',encoding='utf-8')
        print("RedInFile.txt file")
        for folderName, subfolders, filenames in os.walk(sPath):
            for filename in filenames:        
                if filename.endswith('.' + ext2Search4):
                    f.write((folderName + '/' + filename + '\n') )
        f.close()
        
        self.secret_txt=Text(self,width=80,height=10,wrap=WORD)
        self.secret_txt.grid(row=3,column=0,columnspan=2,sticky=W)
 
        with open('RedInFile.txt', 'r') as myfile:
            message=myfile.read()
            
        message
        self.secret_txt.delete(0.0, END)
        self.secret_txt.insert(0.0,message)
 
app=Application(root)

Comments