Tkinter open and close over time...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • egross73
    New Member
    • Mar 2010
    • 2

    Tkinter open and close over time...

    Hello,

    I was wondering if there was a way to make a tkinter window open and close over time. I would probably use the time module and time.sleep() to make it wait, but could I use a command to open a window and then close it after a certain amount of time? Sorry if I am being confusing, I am somewhat new to python and tkinter. Thanks for the help!

    EG

    I am using Vista 64-bit, and Python 3.0 (just in-case you needed to know).
    Last edited by egross73; Mar 5 '10, 06:04 PM. Reason: Additional Information
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    The thing to do would be open the window and trigger an event which saves the current time. Use widget method after() in the event command to call back the event command. Sample call:
    Code:
        self.widget.after(1000, self.event_command)
    The argument 1000 is in milliseconds. When the new time minus the saved time is the desired difference, call mainloop method quit(). Doing it this way, you can keep the window active and up dated.

    Comment

    • egross73
      New Member
      • Mar 2010
      • 2

      #3
      Thanks a lot, and thanks for a quick response!

      EG

      Comment

      Working...