Wondering about new windows in Tkinter

Thread Solved

Join Date: Jul 2005
Posts: 68
Reputation: danizzil14 is an unknown quantity at this point 
Solved Threads: 1
danizzil14's Avatar
danizzil14 danizzil14 is offline Offline
Junior Poster in Training

Wondering about new windows in Tkinter

 
0
  #1
Jul 10th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,003
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 928
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Wondering about new windows in Tkinter

 
0
  #2
Jul 11th, 2005
This snippet will bring up a message window using Toplevel() ...
  1. # display message in a child window
  2.  
  3. from Tkinter import *
  4.  
  5. def messageWindow(message):
  6. # create child window
  7. win = Toplevel()
  8. # display message
  9. Label(win, text=message).pack()
  10. # quit child window and return to root window
  11. Button(win, text='OK', command=win.destroy).pack()
  12.  
  13. def createMessage():
  14. global counter
  15. counter = counter + 1
  16. message = "This is message number " + str(counter)
  17. messageWindow(message)
  18.  
  19.  
  20. counter = 0
  21.  
  22. # create root window
  23. root = Tk()
  24. # put a button on it, command executes the given function on button-click
  25. Button(root, text='Bring up Message', command=createMessage).pack()
  26. # start event-loop
  27. root.mainloop()
Last edited by vegaseat; Aug 12th, 2009 at 4:58 pm.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC