By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,844 Members | 1,889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,844 IT Pros & Developers. It's quick & easy.

How do I save user data in a file and populate the GUI/Software based on that file?

P: 1
So I'm developing a GUI that consists of many widgets such as checkbox, buttons, radio-buttons, combo-box using Python Qt5. This GUI is to perform some calcualtion based on user choices. I'm trying to figure out how to go about saving all this data in a file and then repopulating those widgets when the user opens the same file.

My research lead me to QSetting class of Qt5 but that only saves the states of widgets.

For Example:

def writeSettings(self):
self.settings = QSettings("Moose Soft", "Clipper")
self.settings.beginGroup("MainWindow")
self.settings.setValue("size", self.size())
self.settings.setValue("pos", self.pos())
self.settings.endGroup()

def readSettings(self):
self.settings = QSettings("Moose Soft", "Clipper")
self.settings.beginGroup("MainWindow")
self.resize(settings.value("size", QSize(400, 400)).toSize())
self.move(settings.value("pos", QPoint(200, 200)).toPoint())
self.settings.endGroup()

But this is not doing what I want (or maybe I'm not aware of some of its functionalities?)

Summary: What I want is to have the user save the file and come back to that file after a while and the file should know which widgets was checked/used and repopulate only those. How do I approach this issue?

By the way, I'm new to GUI design :-/
3 Weeks Ago #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.