Tk button enable/disable?
Kevin Cazabon
kcazabon at home.com
Tue May 2 03:10:24 EDT 2000
Well, using normal Tk buttons (through Tkinter), you would call the
following:
whateverTheButtonNameIs.config(state = Normal)
I don't use Pmw very much, but you'd have to know if the Button instance is
"self.newButton", or maybe a subvalue of self.newButton (like
self.newButton.button or whatever).
Kevin.
"Albert Wagner" <alwagner at tcac.net> wrote in message
news:390E4F93.3ADF2ECD at tcac.net...
> 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