Hello all!

Ok here's my problem:

I have a Hello World type program that I want to run in steps, and each step is in a new window. When a "next" button is pressed the old window terminates and a new one is created. Now I don't know much about the command = whatever thingy so I was wondering if you could give me some info on it? Oh and I mostly work with .bind so if so can you give me the example in that form?

Help appreciated.

12 Years
Discussion Span
Last Post by vegaseat

This snippet will bring up a message window using Toplevel() ...

# display message in a child window

from Tkinter import *

def messageWindow(message):
    # create child window
    win = Toplevel()
    # display message
    Label(win, text=message).pack()
    # quit child window and return to root window
    Button(win, text='OK', command=win.destroy).pack()

def createMessage():
    global counter
    counter = counter + 1
    message = "This is message number " + str(counter)

counter = 0
# create root window
root = Tk()
# put a button on it, command executes the given function on button-click
Button(root, text='Bring up Message', command=createMessage).pack()
# start event-loop
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.