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

0 Members and 1 Guest are viewing this topic.

Offline DazTheGas

  • Active Member
  • Posts: 743
  • DazTheGas
    • View Profile
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
Theres always time for a choccy biccy

Offline dah79

  • Active Member
  • Posts: 35
    • View Profile
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

  • Administrator
  • *
  • Posts: 5,432
  • Precision Chaos
    • View Profile
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

  • Active Member
  • Posts: 743
  • DazTheGas
    • View Profile
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
Theres always time for a choccy biccy