Hello Guest it is October 14, 2024, 02:04:12 AM

Author Topic: Mach4 Quicky #3 Using wxTimer  (Read 7148 times)

0 Members and 1 Guest are viewing this topic.

Offline DazTheGas

*
  •  778 778
  • DazTheGas
Mach4 Quicky #3 Using wxTimer
« 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

The Code

Code: [Select]
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
New For 2022 - Instagram: dazthegas

Offline dah79

*
  •  35 35
Re: Mach4 Quicky #3 Using wxTimer
« Reply #1 on: May 19, 2016, 10:19:53 PM »
Thanks Daz for the great explanation and video!

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
Re: Mach4 Quicky #3 Using wxTimer
« Reply #2 on: May 21, 2016, 05:05:13 PM »
That is a good one Daz! Very useful. Thanks!  :)
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline DazTheGas

*
  •  778 778
  • DazTheGas
Re: Mach4 Quicky #3 Using wxTimer
« Reply #3 on: May 26, 2016, 04:35:32 AM »
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
New For 2022 - Instagram: dazthegas