On Thu, 2006-06-01 at 08:31 -0400, Michael Yanowitz wrote: > Hello: > > > I have a Tkinter GUI Dialog with many buttons and labels and text > widgets. > What I would like to do is, can I: > > 1) Disable/deactivate/hide a button, text widget that is already drawn (and > of course the opposite enable/activate/show it)? > > 2) Change the text of a label or button that is already drawn? > > based on actions taken by the user. Can it be done without destroying > the present dialog or the objects in it and creating a new one? > > Sorry for what probably is such a trivial and basic question. I just can't > find the answer or know what the technical term for what I want to do is to > search for it myself.
To disable/deactivate a button widget, use the keyword 'state'. For example, import Tkinter as Tk root = Tk.Tk() bid = Tk.Button(root, text='test', state=Tk.NORMAL) bid.pack() bid.configure(state=Tk.DISABLED) If you want to hide the button (using Pack geometry manager): bid.pack_forget() You can pack it again using bid.pack() but it may be difficult to pack it back where you originally intended. If you are using the Grid geometry manager: bid.grid_forget() To put it back simply call grid again with the same row, column. Changing the text of a label or button already drawn is simply done by a call to the configure method on the button or label's text attribute: bid.configure(text='Help') Regards, John -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- http://mail.python.org/mailman/listinfo/python-list