Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How do I link a txt to my tkinter code that is able to read and take values from it?

With my coursework, i have struggled to get past this stage. I am looking for my code to retrieve data from a .txt file, and also store data in the same file. I have tried a few methods but i can't figure it out. Any help will be appreciated This is my current code:

class Class3():
    def __init__(self):

        self.frame = Frame(root)
        self.frame.grid()
        print("testing")
        self.title = Label(self.frame, text="    Perfect Piano Playing     ")#TITLE
        self.title.grid(row=0, column=2)

        self.user_entry_label = Label(self.frame, text="Username: ")#USERNAME LABEL
        self.user_entry_label.grid(row=1, column=1)

        self.user_entry = Entry(self.frame)
        self.user_entry.grid(row=1, column=2)

        self.pass_entry_label = Label(self.frame, text="Password: ")
        self.pass_entry_label.grid(row=2, column=1)


        self.pass_entry = Entry(self.frame, show='*')
        self.pass_entry.grid(row=2, column=2)

        self.sign_in_butt = Button(self.frame, text="Sign In")#SIGN IN BUTTON
        self.sign_in_butt.grid(row=5, column=2)

    def logging_in(self):
        print("hi")
        user_get = self.user_entry.get()#Retrieve Username
        pass_get = self.pass_entry.get()#Retrieve Password

Comments