Tkinter - changing existing Dialog?

Cameron Laird claird at
Fri Jun 2 03:03:22 CEST 2006

In article <mailman.6401.1149165099.27775.python-list at>,
Michael Yanowitz <m.yanowitz at> wrote:
>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?
  import Tkinter

  root = Tkinter.Tk()

  counter = 0

      # This is one of several ways one can access the Button's label.
  def set_text():
      b.configure(text = "The button has been pushed %d time(s)." % counter)

  def actions():
      global counter
      counter += 1

  b = Tkinter.Button(root, command = actions)

More information about the Python-list mailing list