title: Implementing a preferences dialog window in PyQt
body: <p>I'm trying to use an interface I designed in Qt designer as a means of letting the user edit preferences for my program. </p>
  
  <p>I am currently able to display the GUI I made by connecting the following function to the preferences menu option:</p>
  
  <pre><code>def preferences(self):
  
      preferences_dialog = QtGui.QDialog()
      preferences_dialog.ui = Ui_Preferences()
      preferences_dialog.ui.setupUi(preferences_dialog)
      preferences_dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
      preferences_dialog.exec_()
  </code></pre>
  
  <p>My question is this: what is a good way to implement this so that I can use the fields in the GUI to change values in my config file?</p>
  
  <p>I also want to display the pre-existing values in the boxes before they are changed. </p>
  
  <p>Should I make a new class that uses the above function as its __init__ method? I would imagine I might need a class that handles all of the processes for the window. Also, I am unsure of a good way to pass data between the file and the GUI without a bunch of specific code. </p>
  
  <p><a href="https://i.stack.imgur.com/dnAks.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dnAks.png" alt="enter image description here"></a></p>