NightStone
NightStone

Reputation: 1

How can i make a program go back to it's original state when i click a button? (Tkinter)

I have am making a Account Manager program, and I want to make a reset button so every time it's clicked everything goes back to it's original state(When I mean original state I mean before other buttons were clicked), can anyone help me please?

Here is my code: https://paste.pythondiscord.com/hozasazohe

I tried to remove everything one by one, but it's really difficult to do and is very inefficient, since I can always add something new in the future, and would have to change the reset button again.

Upvotes: 0

Views: 64

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385940

The short answer is that tkinter doesn't have any feature to do this. You'll have to write all of the code to make it happen.

Solutions fall into one of two categories. First, you can write a function that resets all widgets and data structures to their default values. The second solution involves writing one or more functions to initialize your UI, and then just destroy and recreate the entire UI when you want it to be reset.

Upvotes: 1

Related Questions