Tk button enable/disable?
Albert Wagner
alwagner at tcac.net
Mon May 1 23:46:27 EDT 2000
I want to enable and disable buttons in Tk. I tried the following code
but it only partially works:
# Add a button box to the Open page
self.openBBx = Pmw.ButtonBox(self.pad1,
labelpos = 'w',
frame_borderwidth = 2,
frame_relief = 'groove',
orient = 'vertical')
self.openBBx.pack(side='right', padx=3)
#add buttons to box
self.newButton = self.openBBx.add('New',
command=self.newDBrequest)
self.openButton = self.openBBx.add('Open',
command=self.openDBrequest,
state='disabled')
self.closeButton = self.openBBx.add('Close',
command=self.closeDBrequest,
state='disabled')
self.deleteButton = self.openBBx.add('Delete',
command = self.deleteDBrequest,
state='disabled')
Then later when conditions dictate:
self.openButton.state = 'normal'
self.closeButton.state = 'normal'
self.deleteButton.state = 'normal'
self.openButton.update()
self.closeButton.update()
self.deleteButton.update()
They are initially disabled OK, but I cannot figure out how to later
enable them. Any help greatly appreciated.
--
Small is Beautiful
More information about the Python-list
mailing list