How to save a data after closing a window?Why are multiple instances of Tk discouraged?How to merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How can I safely create a nested directory?How can I make a time delay in Python?How do I sort a dictionary by value?How to make a chain of function decorators?How to make a flat list out of list of listsHow do I list all files of a directory?How do I install pip on Windows?

What do you call a flexible diving platform?

The Sword in the Stone

Melee or Ranged attacks by Monsters, no distinction in modifiers?

What language is Raven using for her attack in the new 52?

Why is it considered Acid Rain with pH <5.6

Why do planes need a roll motion?

How should we understand λαμβάνω in John 5:34?

Why is drive/partition number still used?

How could Nomadic scholars effectively memorize libraries worth of information

When does Haskell complain about incorrect typing in functions?

Why can't my huge trees be chopped down?

How many oliphaunts died in all of the Lord of the Rings battles?

How can I write an interdental lateral in phonetic transcription?

Sea level static test of an upper stage possible?

How to get CPU-G to run on 18.04

What is the most common end of life issue for a car?

Does academia have a lazy work culture?

Did the meaning of "significant" change in the 20th century?

How did the Axis intend to hold the Caucasus?

If Trump gets impeached, how long would Pence be president?

What is the difference between position, displacement, and distance traveled?

Recommendations or Experiences on Archiving Mailing Data

Isolated audio without a transformer

Am I allowed to use personal conversation as a source?



How to save a data after closing a window?


Why are multiple instances of Tk discouraged?How to merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How can I safely create a nested directory?How can I make a time delay in Python?How do I sort a dictionary by value?How to make a chain of function decorators?How to make a flat list out of list of listsHow do I list all files of a directory?How do I install pip on Windows?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm trying to make some GUI on Python3 with tkinter. So far I have Main Window and 'Test' button on it, which opens second window. Second window has entry, label, save and close buttons. When you type something in entry and press save button, label shows the text you typed in entry. But after closing this window and opening it again, label shows nothing. How do I make this label to show the text that were typed last time before closing? For example, I type 'Hi' in entry, press 'Save', then I press 'Close', then I open this window again and label shows 'Hi'



import tkinter as tk

def save_data(entry, t):
t.config(text = entry.get())

def close_action(current_window):
current_window.destroy()

def insertMainInfo():
new_window = tk.Tk()
new_window.geometry("307x131")
new_window.title("TestWindow")

test_entry = tk.Entry(new_window)
test_entry.place(relx = 0.283, rely = 0.1, height = 24, width = 127)

text = tk.Label(new_window)
text.place(relx = 0.283, rely = 0.25, height = 24, width = 127)

save_button = tk.Button(new_window, command = lambda: save_data(test_entry, text))
save_button.place(relx=0.283, rely=0.45, height=24, width=127)
save_button.configure(text = "Save")

close = tk.Button(new_window, command = lambda: close_action(new_window))
close.place(relx=0.283, rely=0.687, height=24, width=127)
close.configure(text = "Close")

new_window.mainloop()

if __name__ == '__main__':

top = tk.Tk()
top.geometry("307x131+557+330")
top.resizable(width=False, height=False)
top.title("MainWindow")

new_window_button = tk.Button(top, command = insertMainInfo)
new_window_button.place(relx=0.283, rely=0.687, height=24, width=127)
new_window_button.configure(text = "Test")

main_label = tk.Label(top)
main_label.place(relx=0.033, rely=0.153, height=41, width=284)
main_label.configure(text = "TestLabel")

top.mainloop()









share|improve this question
























  • In general saving data involves writing the data to your disk for later retrieval. See reading/writing file.

    – Roca
    Mar 26 at 18:16







  • 1





    Read Why are multiple instances of Tk discouraged?

    – stovfl
    Mar 26 at 19:05











  • You can create a StringVar and pass it as a argument of insertMainInfo(). Then set the textvariable option to this variable for both label and entry.

    – acw1668
    Mar 26 at 23:16

















2















I'm trying to make some GUI on Python3 with tkinter. So far I have Main Window and 'Test' button on it, which opens second window. Second window has entry, label, save and close buttons. When you type something in entry and press save button, label shows the text you typed in entry. But after closing this window and opening it again, label shows nothing. How do I make this label to show the text that were typed last time before closing? For example, I type 'Hi' in entry, press 'Save', then I press 'Close', then I open this window again and label shows 'Hi'



import tkinter as tk

def save_data(entry, t):
t.config(text = entry.get())

def close_action(current_window):
current_window.destroy()

def insertMainInfo():
new_window = tk.Tk()
new_window.geometry("307x131")
new_window.title("TestWindow")

test_entry = tk.Entry(new_window)
test_entry.place(relx = 0.283, rely = 0.1, height = 24, width = 127)

text = tk.Label(new_window)
text.place(relx = 0.283, rely = 0.25, height = 24, width = 127)

save_button = tk.Button(new_window, command = lambda: save_data(test_entry, text))
save_button.place(relx=0.283, rely=0.45, height=24, width=127)
save_button.configure(text = "Save")

close = tk.Button(new_window, command = lambda: close_action(new_window))
close.place(relx=0.283, rely=0.687, height=24, width=127)
close.configure(text = "Close")

new_window.mainloop()

if __name__ == '__main__':

top = tk.Tk()
top.geometry("307x131+557+330")
top.resizable(width=False, height=False)
top.title("MainWindow")

new_window_button = tk.Button(top, command = insertMainInfo)
new_window_button.place(relx=0.283, rely=0.687, height=24, width=127)
new_window_button.configure(text = "Test")

main_label = tk.Label(top)
main_label.place(relx=0.033, rely=0.153, height=41, width=284)
main_label.configure(text = "TestLabel")

top.mainloop()









share|improve this question
























  • In general saving data involves writing the data to your disk for later retrieval. See reading/writing file.

    – Roca
    Mar 26 at 18:16







  • 1





    Read Why are multiple instances of Tk discouraged?

    – stovfl
    Mar 26 at 19:05











  • You can create a StringVar and pass it as a argument of insertMainInfo(). Then set the textvariable option to this variable for both label and entry.

    – acw1668
    Mar 26 at 23:16













2












2








2








I'm trying to make some GUI on Python3 with tkinter. So far I have Main Window and 'Test' button on it, which opens second window. Second window has entry, label, save and close buttons. When you type something in entry and press save button, label shows the text you typed in entry. But after closing this window and opening it again, label shows nothing. How do I make this label to show the text that were typed last time before closing? For example, I type 'Hi' in entry, press 'Save', then I press 'Close', then I open this window again and label shows 'Hi'



import tkinter as tk

def save_data(entry, t):
t.config(text = entry.get())

def close_action(current_window):
current_window.destroy()

def insertMainInfo():
new_window = tk.Tk()
new_window.geometry("307x131")
new_window.title("TestWindow")

test_entry = tk.Entry(new_window)
test_entry.place(relx = 0.283, rely = 0.1, height = 24, width = 127)

text = tk.Label(new_window)
text.place(relx = 0.283, rely = 0.25, height = 24, width = 127)

save_button = tk.Button(new_window, command = lambda: save_data(test_entry, text))
save_button.place(relx=0.283, rely=0.45, height=24, width=127)
save_button.configure(text = "Save")

close = tk.Button(new_window, command = lambda: close_action(new_window))
close.place(relx=0.283, rely=0.687, height=24, width=127)
close.configure(text = "Close")

new_window.mainloop()

if __name__ == '__main__':

top = tk.Tk()
top.geometry("307x131+557+330")
top.resizable(width=False, height=False)
top.title("MainWindow")

new_window_button = tk.Button(top, command = insertMainInfo)
new_window_button.place(relx=0.283, rely=0.687, height=24, width=127)
new_window_button.configure(text = "Test")

main_label = tk.Label(top)
main_label.place(relx=0.033, rely=0.153, height=41, width=284)
main_label.configure(text = "TestLabel")

top.mainloop()









share|improve this question
















I'm trying to make some GUI on Python3 with tkinter. So far I have Main Window and 'Test' button on it, which opens second window. Second window has entry, label, save and close buttons. When you type something in entry and press save button, label shows the text you typed in entry. But after closing this window and opening it again, label shows nothing. How do I make this label to show the text that were typed last time before closing? For example, I type 'Hi' in entry, press 'Save', then I press 'Close', then I open this window again and label shows 'Hi'



import tkinter as tk

def save_data(entry, t):
t.config(text = entry.get())

def close_action(current_window):
current_window.destroy()

def insertMainInfo():
new_window = tk.Tk()
new_window.geometry("307x131")
new_window.title("TestWindow")

test_entry = tk.Entry(new_window)
test_entry.place(relx = 0.283, rely = 0.1, height = 24, width = 127)

text = tk.Label(new_window)
text.place(relx = 0.283, rely = 0.25, height = 24, width = 127)

save_button = tk.Button(new_window, command = lambda: save_data(test_entry, text))
save_button.place(relx=0.283, rely=0.45, height=24, width=127)
save_button.configure(text = "Save")

close = tk.Button(new_window, command = lambda: close_action(new_window))
close.place(relx=0.283, rely=0.687, height=24, width=127)
close.configure(text = "Close")

new_window.mainloop()

if __name__ == '__main__':

top = tk.Tk()
top.geometry("307x131+557+330")
top.resizable(width=False, height=False)
top.title("MainWindow")

new_window_button = tk.Button(top, command = insertMainInfo)
new_window_button.place(relx=0.283, rely=0.687, height=24, width=127)
new_window_button.configure(text = "Test")

main_label = tk.Label(top)
main_label.place(relx=0.033, rely=0.153, height=41, width=284)
main_label.configure(text = "TestLabel")

top.mainloop()






python tkinter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 18:30







Oliver Tracey

















asked Mar 26 at 18:11









Oliver TraceyOliver Tracey

113 bronze badges




113 bronze badges












  • In general saving data involves writing the data to your disk for later retrieval. See reading/writing file.

    – Roca
    Mar 26 at 18:16







  • 1





    Read Why are multiple instances of Tk discouraged?

    – stovfl
    Mar 26 at 19:05











  • You can create a StringVar and pass it as a argument of insertMainInfo(). Then set the textvariable option to this variable for both label and entry.

    – acw1668
    Mar 26 at 23:16

















  • In general saving data involves writing the data to your disk for later retrieval. See reading/writing file.

    – Roca
    Mar 26 at 18:16







  • 1





    Read Why are multiple instances of Tk discouraged?

    – stovfl
    Mar 26 at 19:05











  • You can create a StringVar and pass it as a argument of insertMainInfo(). Then set the textvariable option to this variable for both label and entry.

    – acw1668
    Mar 26 at 23:16
















In general saving data involves writing the data to your disk for later retrieval. See reading/writing file.

– Roca
Mar 26 at 18:16






In general saving data involves writing the data to your disk for later retrieval. See reading/writing file.

– Roca
Mar 26 at 18:16





1




1





Read Why are multiple instances of Tk discouraged?

– stovfl
Mar 26 at 19:05





Read Why are multiple instances of Tk discouraged?

– stovfl
Mar 26 at 19:05













You can create a StringVar and pass it as a argument of insertMainInfo(). Then set the textvariable option to this variable for both label and entry.

– acw1668
Mar 26 at 23:16





You can create a StringVar and pass it as a argument of insertMainInfo(). Then set the textvariable option to this variable for both label and entry.

– acw1668
Mar 26 at 23:16












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363748%2fhow-to-save-a-data-after-closing-a-window%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363748%2fhow-to-save-a-data-after-closing-a-window%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현