I want to save and load my GUI.
I have made a GUI and I want that when I click on the save button.
It should save the GUI in some blob of data and when I click on load button then it will load the same GUI again.
My GUI has various text widgets, drop down Option Menu. I am new to python, so someone can help me on this, please?
I have tried pickle module, too.
You can't do what you want to do without doing the work yourself. You'll need to write a function that gathers all the data you need in order to restore the GUI, and then you can save that to disk. Then, when the GUI starts up you can read the data and reconfigure the widgets to contain this data.
Tkinter gives you pretty much everything you need in order to accomplish it, but you have to do all the work yourself. Pickling the GUI won't work.
Here's a contrived example. Enter a few expressions in the window that pops up. Notice that they are added to the combobox. When you exit, the current expression, the saved expressions, and the current value are all saved. The next time you start the GUI, these values will be restored.
the example given doesn't work. It doesn't save the state and gives the error-- error loading saved state: 'str' does not support the buffer interface