Hi
I am C++ programmer new to Python.Developing graphical application using Tkinter.
As shown in screenshot
I programmed in such a way that when I press MC_CONFIG button new frame will open.
Inside that I am giving path using
XML PATH button
opening and reading xml using
MC_SYSTEM.xml button
After editing I gave two options
1--> OK (when Ok is pressed file is opened,xml parameters are written(we can edit) and closed with message"configuration file written successfully"
2--> Cancel(Ideally I want only the widget window where I am adding xml values need to be closed as shown in attachment.For that I used self.pack_forget()and it removes the widget and works.But when I go back and again click the button MC_CONFIG it is not opening.
Please guide me.
Code for On OK
Code:
def onOK(self):
# set values in xml document
print "-------Setting Element-----------"
for k in range(self.nac_xmlparam1_index):
setElementValue (self.xmlDocument,self.nac_xmlparam[k],self.nac_xmlparam1[k],self.database[k].get())
#print("self.database s" self.database[k].get())
# open XML file
f = open ("SYSTEM.xml","w")
#f = open (xml_path.filename,"w")
# set xml header
fprintf (f,'\n')
# write XML document to XML file
self.xmlDocument.writexml (f)
# close XML file
f.close ()
# show confirmation message
tkMessageBox.showerror ("Message","Configuration updated successfully")
# exit program
#self.quit();
Code for On Cancel
Code:
def onCancel(self):
# exit program
#self.quit();
self.pack_forget()