Getting some weird console output from GeDialog.Timer()
-
Hello there^^
I wanted to implement the GeDialoge.Timer() in one of my scripts and realized that it creates some
output in the console and I dont know where its coming from or how to prevent it.When I run this example script:
import c4d from c4d import gui _dlg = None class TimerTestDialog(gui.GeDialog): ID_STATUS = 1000 ID_BTN = 1001 def __init__(self): super().__init__() self._ticks = 0 def CreateLayout(self): self.SetTitle("Timer Test") self.AddStaticText(self.ID_STATUS, c4d.BFH_LEFT, name="Starting…") self.AddButton(self.ID_BTN, c4d.BFH_LEFT, name="Close Dialoge") self.SetTimer(1000) return True def Command(self, wid, msg): if wid == self.ID_BTN: self.Close() return True return False def Timer(self, msg): self._ticks += 1 self.SetString(self.ID_STATUS, f"Ticks: {self._ticks}") return True def main(): global _dlg _dlg = TimerTestDialog() _dlg.Open(c4d.DLG_TYPE_ASYNC, defaultw=260, defaulth=80) if __name__ == "__main__": main()I get the following console output:
(null)(null)(null)(null)(null)(null)(null)骥pf(null)骥pf(null)(null)骥pf(null)(null)骥pfHas anyone else experienced this before?
Thanks in advance for any help or hints!
Cheers,
Ben -
Timer should return None:
def Timer(self, msg: BaseContainer) -> None: """ If you subscribe to timer events using :meth:`SetTimer` (x), this function is called every x'th millisecond. :type msg: BaseContainer :param msg: The raw timer message. """ pass -
Thank you @Dunhou ! That solved it!