How to stop wx.Gauge pulsing?

Hi,

wx.Gauge.Pulse() makes gauge pulse continiously, but do you know how to stop gauge pulsing?

Thanks

Are you using a timer? If so, you can stop the timer.

#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 1.0.2 on Sat Nov  6 19:19:10 2021
#

import wx

# begin wxGlade: dependencies
# end wxGlade

# begin wxGlade: extracode
# end wxGlade


class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((400, 100))
        self.SetTitle("frame")

        self.panel_1 = wx.Panel(self, wx.ID_ANY)

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        self.gauge_1 = wx.Gauge(self.panel_1, wx.ID_ANY, 10)
        sizer_1.Add(self.gauge_1, 0, wx.EXPAND | wx.TOP, 8)

        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, 8)

        self.start_button = wx.Button(self.panel_1, wx.ID_ANY, "Start")
        sizer_2.Add(self.start_button, 0, wx.RIGHT, 8)

        self.stop_button = wx.Button(self.panel_1, wx.ID_ANY, "Stop")
        sizer_2.Add(self.stop_button, 0, 0, 0)

        self.panel_1.SetSizer(sizer_1)

        self.Layout()
        # end wxGlade

        self.Bind(wx.EVT_BUTTON, self.OnStart, self.start_button)
        self.Bind(wx.EVT_BUTTON, self.OnStop, self.stop_button)
        self.Bind(wx.EVT_TIMER, self.TimerHandler)
        self.timer = wx.Timer(self)


    def OnStart(self, event):
        if not self.timer.IsRunning():
            self.timer.Start(100)


    def OnStop(self, event):
        if self.timer.IsRunning():
            self.timer.Stop()
            self.gauge_1.SetValue(0)

    
    def TimerHandler(self, event):
        self.gauge_1.Pulse()


# end of class MyFrame

class MyApp(wx.App):
    def OnInit(self):
        self.frame = MyFrame(None, wx.ID_ANY, "")
        self.SetTopWindow(self.frame)
        self.frame.Show()
        return True

# end of class MyApp

if __name__ == "__main__":
    app = MyApp(0)
    app.MainLoop()

Hi.
You juste have to set the value of the wx.Gauge to make it stop pulsing :

# To clear the gauge:
myGauge.Value = 0
# To make it full
myGauge.Value = myGauge.Range

Regards
Xav’