title: Implementing a config file on a GUI with Tkinter | Python
body: <p>I'm Writing a user friendly GUI for editing the Config file of an .exe file.</p>
  <p>The config file is called xenia.config.toml</p>
  <p>Users can change the config manually</p>
  <p>What this program essentially does is that it just rewrites the configs values.</p>
  <p>This is a Simple summary of the my code:</p>
  <pre><code>import toml
  from tkinter import *
  root = Tk()
  root.title(&quot;Xenia Config Editor&quot;)
  root.geometry(&quot;600x400&quot;)
  readconfig = open(&quot;xenia.config.toml&quot;, &quot;r&quot;)
  dict = toml.load(readconfig, _dict=dict)
  
  
  #Functions
  def vsync_func():
      section = dict['GPU']
  
      if (vsync.get() == 1):
          section['vsync'] = 'true'
      elif (vsync.get() == 0):
          section['vsync'] = 'false'
  def apply():
      with open('xenia.config.toml.tmp', 'w') as f:
          new_toml_string = toml.dump(dict, f)
  
  
  #Variables
  vsync = IntVar()
  section = dict['GPU']
  if section['vsync'] == 'true':
      vsync.set(1)
  elif section['vsync'] == 'false':
      vsync.set(0)
  
  # Checkboxes
  vsync_checkbox = Checkbutton(root, text=&quot;Vsync&quot;, variable=vsync, onvalue=1, offvalue=0, command=vsync_func)
  vsync_checkbox.pack()
  
  
  #Buttons
  applyButton = Button(root, text=&quot;Save The Config&quot;, command=apply).pack()
  
  
  root.mainloop()
  </code></pre>
  <p>My problem is that I want the python code to get the value of vsynce in the config (It's either true, or false) and return it in the check box.</p>
  <p>as you can see I did this:</p>
  <pre><code>vsync = IntVar()
  section = dict['GPU']
  if section['vsync'] == 'true':
      vsync.set(1)
  elif section['vsync'] == 'false':
      vsync.set(0)
  </code></pre>
  <p>But it didn't work
  I want it to basically get the vsync value from the start, and implement it on the check box (if vsync has the value of true in the config, then check box should be checked and vise versa)</p>
  <p>But all I can do is to change config by checking/unchecking the check box, I want to be able to do the reverse too.</p>