Search code examples
pythonuser-interfacewxpythonwxwidgets

Saving/Loading GUI with wxPython


I created a UI builder with wxpython meaning I can dynamically create buttons and other widgets then the program will give me the code.

Here is the problem: How can I let the user save their work? Then load it later, and all the widgets will be back on the screen?

I tried in all the ways I can, even by using exec() but I always run into problems.

Can someone please post a example on how to do this? I can't find anything on the internet for this problem.


Solution

  • You may be able to use PersistenControls to help with this: http://xoomer.virgilio.it/infinity77/main/PersistentControls.html

    It's actually included in wxPython now, I think. Probably since 2.8.11. Otherwise, you could use XRC to save it as XML. See the following links for more info: