hello
i am creating a Tix.FileSelectBox to select some jpeg files
on clicking an OK button i wish to get the selected imagename as
string ,so i code like below


class TixGUI:
        def __init__(self, parent):
            ....
            self.imgsel=FileSelectBox(self.bgframe)
            self.imgsel.configure(pattern="*.jp*")
            self.imgsel.pack(side=LEFT)

            self.okButton = Button(self.bgframe,text="OK")
            self.okButton.bind("<Button-1>",self.okbuttonClick)
            self.okButton.pack(side=LEFT )

        def  okbuttonClick(self,event):
             self.cursel=self.imgsel.selection.cget("value")
              print "selected image::",self.cursel

here if i select an imagefile say sh1.jpg and click ok..it will print
the imagefilename..BUT if i just select a folder next and don't choose
any imagefile ,it will still print the previous value of sh1.jpg..

i managed to set the selection to "" by adding a
self.imgsel.selection.__setitem__("value","")
 to the end of  okbuttonClick(self,event).. but i want to know if this
is the correct way .or is there another way to clear the selection?

thanx in adv
dn
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to