import configparser #from tkinter import * import tkinter as tk window = tk.Tk() frame = tk.Frame(master=window, width=150, height=150) frame.pack() # frame = tk.Frame(config) config = configparser.ConfigParser() config.read('config.conf') """ tmgdspen = config.get('modules', 'tmgdsp') vfgdspen = config.get('modules', 'vfgdsp') tmczen = config.get('modules', 'tmcz') vfczen = config.get('modules', 'vfcz') print(tmgdspen) print(vfgdspen) print(tmczen) print(vfczen) """ tmgdspen = tk.IntVar() vfgdspen = tk.IntVar() tmczen = tk.IntVar() vfczen = tk.IntVar() tmgdspen.set(int(config.get('modules', 'tmgdsp'))) vfgdspen.set(int(config.get('modules', 'vfgdsp'))) tmczen.set(int(config.get('modules', 'tmcz'))) vfczen.set(int(config.get('modules', 'vfcz'))) checktmgdsp = tk.Checkbutton(window, text="TMGDSP", variable=tmgdspen, onvalue=1, offvalue=0) checktmgdsp.place(x=10, y=10) checkvfgdsp = tk.Checkbutton(window, text="VFGDSP", variable=vfgdspen, onvalue=1, offvalue=0) checkvfgdsp.place(x=10, y=30) checktmcz = tk.Checkbutton(window, text="TMCZ", variable=tmczen, onvalue=1, offvalue=0) checktmcz.place(x=10, y=50) checkvfcz = tk.Checkbutton(window, text="VFCZ", variable=vfczen, onvalue=1, offvalue=0) checkvfcz.place(x=10, y=70) window.mainloop()