Jan-28-2019, 03:40 AM
(This post was last modified: Jan-28-2019, 03:58 AM by ichabod801.)
Hi I m a beginner. Try to learn python by myself. I started to create a program to help me keeping track of information. (kind of excel sheet but in python) I stuck with a problem i spend hours on it but don t figure it out.
This program open a window where you can write a shot number and check or not with a chekerbox. I already manage to create the interface but don t know how to save it on a files and retreive the information. I already start something with txt files but still not working. Try with csv files too , still not working. I include the code it s running. (python2.7) The program dont save variable input and of courses don retreive info when you open the files again . I manage to create a save button but button dont work.I m open to any help. Thanks a lot for your help.
This program open a window where you can write a shot number and check or not with a chekerbox. I already manage to create the interface but don t know how to save it on a files and retreive the information. I already start something with txt files but still not working. Try with csv files too , still not working. I include the code it s running. (python2.7) The program dont save variable input and of courses don retreive info when you open the files again . I manage to create a save button but button dont work.I m open to any help. Thanks a lot for your help.
from Tkinter import* root = Tk() entry_1 = Entry(root,width= 10) entry_2 = Entry(root,width= 10) label_1 = Label (root, width= 10, text = "Shot") label_2 = Label (root, width= 12, text = "Ready", bg = "pink3") label_3 = Label (root, width= 12, text = "Wait") entry_1.grid(row=1) label_1.grid(row=0, column=0) label_2.grid(row=0, column=1) label_3.grid(row=0, column=2) def var_states(): SavAll = open("Filestoto3.txt", "wb") SavAll.write(var1.get()) SavAll.close() var1 = BooleanVar() Checkbutton(root, variable=var1).grid(row=1, column=1) var2 = BooleanVar() Checkbutton(root, variable=var2).grid(row=1, column=2) Button(root, text='Quit', command=root.quit).grid(row=11, sticky=W, pady=4) Button(root, text='Save', command=var_states).grid(row=12, sticky=W, pady=4)