Re: glib.timeout_add doesn't works well

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if (condition):
          glib.timeout_add(i,f)
 
def f:

        (...)
        i = (....)
        (condition)
        return True

Even the value of "i" is different each time I call "f", glib.timeout_add(i,f) call "f" always with the same value of "i".

Changing the value of "i" will not change the timeout because it was already called and the value of "i" was copied there when passing the parameter. You must call the timeout again like this:

if (condition):
  glib.timeout_add(first_timeout, f)
 
def f:

  (...)
  i = (....)
  if (condition):
    glib.timeout_add(i, f) # This will start another timeout with the new interval
  return False # This will end this timeout!

Regards,
Ian L. Rodrigues
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux