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.

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)
    messageWindow(message)
    

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
root.mainloop()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.