Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Save and load files from Tkinter buttons

$
0
0

I am trying to figure out how to save settings but I'm stumped on how to.

I trying to save a scale, checkbox, and a optionmenu and be able to save to a file then load that file to save your settings after you close the program.

from tkinter import *root = Tk()root.title("config test")root.geometry("500x500")b4 =IntVar()b5 =IntVar()we =IntVar()checkbutton1 = Checkbutton(root, text="test1", variable=b4, onvalue=35564533,offvalue=35456533).grid(row=0, column=0)checkbutton2 = Checkbutton(root, text="test2", variable=b5, onvalue=35456533,offvalue=35564533).grid(row=0, column=1)ma3r = StringVar(root)ma3r.set("Normal")r = OptionMenu(root, ma3r, "test1", "test2", "test3").grid(row=2,column=0)Scal = Scale(root, from_=-100, to=100, orient=HORIZONTAL, variable=we).grid(row=1, column=0)mar = StringVar(root)mar.set("CFG1")w = OptionMenu(root, mar, "CFG1", "CFG2", "CFG3").grid(row=3,column=0)butto = Button(root, text="save CFG").grid(row=4,column=0)butto = Button(root, text="load CFG").grid(row=5,column=0)mainloop()

Viewing all articles
Browse latest Browse all 5049

Trending Articles