QSettings(): How to save to current working directory

后端 未结 1 1784
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-15 14:08

For an app that can be run directly from a flash/pen/usb/jump/thumb drive, for portability in moving from one machine to another it can make sense for user settings to be stored

相关标签:
1条回答
  • 2021-02-15 14:38

    You can use that overload class QSettings(fileName, format[, parent=None]) like this:

    self.settings = QSettings("__settings.ini", QSettings.IniFormat)
    

    If the path is relative, the file will already be opened in the current working directory, but that may not be what you want.
    You may try one of these answers to use the directory where the script is instead.

    0 讨论(0)
提交回复
热议问题