Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7494603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:39:46+00:00 2026-05-29T17:39:46+00:00

I need to create a GUI application with Tkinter that requires a lot of

  • 0

I need to create a GUI application with Tkinter that requires a lot of text-field entries. The user has to input all entries, then use a ‘Run’ button to execute a particular function. What I want to do is: include a functionality that restores ALL text data entered by the user from a previous session, so that the user doesn’t have to enter all the data again and again each time. I could use the entry_box.set(‘desired string’) option, but this is static and does not take into account the previous GUI sessions.

For example, in the following script:

#!usr/bin/env python
from Tkinter import *

# Define input retrieve function for application input
def retrieve_text():
    print(app_entry.get())

if __name__ == "__main__":

    # Create window (or form)
    app_win = Tk()

    # Create label
    app_label = Label(app_win, text="Enter value")
    app_label.pack()

    # Create entry box
    app_entry = Entry(app_win)
    app_entry.pack()

    # Create button
    app_button = Button(app_win, text="Print Value", command=retrieve_text)
    app_button.pack()

    # Initialize GUI loop
    app_win.mainloop()

I run this GUI and enter ‘Value1’ in the entry box. Then, I want to close the window, re-run it and the entry ‘Value1’ to appear by default. Each session should display the value from the previous session (The value is manually entered only the first time). Is there any way to do this?

This would be very useful because in my case, a user only has to change one or two fields out of around 10 each time the GUI is rerun.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T17:39:54+00:00Added an answer on May 29, 2026 at 5:39 pm

    In your main, add a handler to close event using this.

     app_win.protocol("WM_DELETE_WINDOW", handler)
    

    Now, whenever the close button will be pressed, the function handler will be called.

    def handler():
        f = open("backup", "w")
        f.write(app_entry.get())
        f.close()
        app_win.quit()
    

    Now, you can modify your program to read the file & set the text when the script is restarted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a simple windows based GUI for a desktop application that
I need to create a plug-in (with GUI) for an application that loads them
I need to create a console application that has a main() function and pop
i need to create an application in java that would convert text strings into
I have a windows application which has a complex GUI that I would like
I want to use Qt to create a simple GUI application that can play
I am developing a Windows GUI Application. I need a tool to create a
I need to create a windows DLL that exports functions and has a graphical
I need to create an application that is primarily going to be about numbers
I might need to write some GUI application that runs on .Net (and Windows),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.