By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,483 Members | 3,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,483 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.setValue("size", self.size())
self.settings.setValue("pos", self.pos())

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

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 :-/
Apr 26 '19 #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.