why does my python's program die after change computer system time?

Discussion in 'Python' started by fuzziy, Jun 3, 2009.

  1. fuzziy

    fuzziy Guest

    Microsoft windowsXP ÖУ¬ÔÚpython2.6ÏÂÔËÐÐÈçϳÌÐò£¬ÏÔʾһ¸öʱ¼äµÄ´°¿Ú¡£µ±Ë«»÷×ÀÃæÓÒϽǵÄʱ¼ä£¬È»ºó¸ü¸Äʱ¼ä»òÈÕ
    ÆÚ£¬¶à´Î¸ü¸Äºó£¬ÎÒµÄʱ¼ä´°¿Ú¾ÍËÀ»úÁË£¬Ê±¼ä²»±äÁË¡£ºÃÏñÊÇafter(200, tick)²»ÔËÐÐÁË¡£²»ÖªµÀΪÔõôÕâ¸ö¶¨Ê±Æ÷»áËÀµôÄØ¡£Çë¸÷λָ½Ì£¬
    лл£¡£¡

    import Tkinter
    import time

    curtime = ''
    clock_label = Tkinter.Label()
    clock_label.pack()

    def tick():
    global curtime
    #print("1:")
    newtime = time.strftime('%Y-%m-%d %H:%M:%S')
    if newtime != curtime:
    curtime = newtime
    clock_label.config(text=curtime)
    clock_label.config(text=newtime)
    clock_label.after(200, tick)
    #print(curtime)

    tick()
    clock_label.mainloop()
     
    fuzziy, Jun 3, 2009
    #1
    1. Advertising

  2. Re: why does my python's program die after change computer systemtime?

    En Wed, 03 Jun 2009 04:08:03 -0300, fuzziy <>
    escribió:

    > [why does my python's program die after change computer system time?]


    > def tick():
    > ...show current time...
    > clock_label.after(200, tick)


    What do you mean by "die"?
    Did you set the system time to an earlier value? Suppose now it is
    09:15:00.000; your program says after(200, tick), that means that at
    09:15:00.200 the tick() function will be called. If you
    set the time back to 09:00:00 your program has 15 minutes still to wait.
    It hasn't died, it's just waiting for the right time to arrive.

    I'm not sure if this can be considered a bug, or not, or who's responsible
    (tcl? tk? tkinter? python?...)

    --
    Gabriel Genellina
     
    Gabriel Genellina, Jun 3, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lloyd Sheen

    Die IDE Die

    Lloyd Sheen, Jan 24, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    446
    Natty Gur
    Jan 26, 2004
  2. Lloyd Sheen

    More Die IDE Die

    Lloyd Sheen, Jan 24, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    461
    Alvin Bruney
    Jan 25, 2004
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,077
    Smokey Grindel
    Dec 2, 2006
  4. Ro
    Replies:
    3
    Views:
    381
    Lawrence Kirby
    Jan 26, 2005
  5. Replies:
    8
    Views:
    342
Loading...

Share This Page