Machsupport Forum
Mach Discussion => Mach4 General Discussion => Mach4 Videos => Topic started by: DazTheGas on May 19, 2016, 05:24:50 PM
-
Ever needed a timer in mach4 that wasnt in a loop like a = a +1 etc then try wxTimer
https://youtu.be/nkCx2xdoPEw (https://youtu.be/nkCx2xdoPEw)
The Code
TimerPanel = wx.wxPanel (wx.NULL, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxDefaultSize )
timer = wx.wxTimer(TimerPanel)
TimerPanel:Connect(wx.wxEVT_TIMER,
function (event)
-- Whatever code or function you need here
timer:Stop()
end)
timer:Start(10000)
DazTheGas
-
Thanks Daz for the great explanation and video!
-
That is a good one Daz! Very useful. Thanks! :)
-
There seems to be a bug somewhere, not sure where? as you can see from the video I dont get an error when running. but an error does exist if I run in script debug mode?
If you do get an error then change the first line to TimerPanel = wx.wxPanel (wx.NULL, wx.wxID_ANY, wx.wxDefaultPosition, wx.wxSize( 500,300 )) - Thanks Brett for the fix.
DazTheGas