Missing Function description

Hallo,
i found a Missing Discription for a Fundamental function for PyGauge.

https://docs.wxpython.org/wx.lib.agw.pygauge.PyGauge.html

it should be Refresh() with announced.
PyGouge do not self Refresh, when it get a new value over SetValue() like it wx.Gauge does

BR
Moppi

Update (self , value , time=0 ) ?

Update is a Other Function, the Scale is over time X to reach the desired Destination. to see a smooth Gauge.

As a workaround, you could sub-class PyGauge and override its SetValue method. It appears to work in the example below, but I haven’t tested all of the class’s functionality to see if it has broken anything.

import wx
import wx.lib.agw.pygauge as PG

class MyPyGauge(PG.PyGauge):
    def SetValue(self, value):
        super().SetValue(value)
        self.Refresh()


class MyFrame(wx.Frame):

    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "PyGauge")
        self.panel = wx.Panel(self)
        self.gauge = MyPyGauge(self.panel, -1, size=(200, 25), style=wx.GA_HORIZONTAL)
        self.gauge.SetBackgroundColour(wx.WHITE)
        self.gauge.SetBorderColor(wx.BLACK)
        self.gauge.SetRange(100)
        self.gauge.SetValue(0)
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        for v in (0, 25, 50, 100):
            b = wx.Button(self.panel, -1, str(v), size=(50, -1))
            self.Bind(wx.EVT_BUTTON, self.OnButton, b)
            button_sizer.Add(b, 0, wx.RIGHT, 8)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.gauge, 0, wx.ALIGN_CENTER | wx.ALL, 20)
        sizer.Add(button_sizer, 0, wx.ALIGN_CENTER | wx.ALL, 20)
        self.panel.SetSizer(sizer)
        sizer.Layout()


    def OnButton(self, event):
        b = event.GetEventObject()
        v = int(b.GetLabel())
        self.gauge.SetValue(v)


app = wx.App(0)
frame = MyFrame(None)
frame.Show()
app.MainLoop()

… Ummm if docs func fails:
Then do the right thing… LOL
Missing Function description…
… Must be a header hear.

well, @RichardT likes sub classing :kissing_heart:

import wx
import wx.lib.agw.pygauge as PG


class MyFrame(wx.Frame):

    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "PyGauge")
        self.panel = wx.Panel(self)
        self.gauge = PG.PyGauge(self.panel, -1, size=(200, 25), style=wx.GA_HORIZONTAL)
        self.gauge.SetBackgroundColour(wx.WHITE)
        self.gauge.SetBorderColor(wx.BLACK)
        self.gauge.SetRange(100)
        self.gauge.SetValue(0)
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        for v in (1, 25, 50, 100):
            b = wx.Button(self.panel, -1, str(v), size=(50, -1))
            self.Bind(wx.EVT_BUTTON, self.OnButton, b)
            button_sizer.Add(b, 0, wx.RIGHT, 8)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.gauge, 0, wx.ALIGN_CENTER | wx.ALL, 20)
        sizer.Add(button_sizer, 0, wx.ALIGN_CENTER | wx.ALL, 20)
        self.panel.SetSizer(sizer)
        sizer.Layout()


    def OnButton(self, event):
        b = event.GetEventObject()
        v = int(b.GetLabel())
        v -= self.gauge.GetValue()
        self.gauge.Update(v,1)


app = wx.App(0)
frame = MyFrame(None)
frame.Show()
app.MainLoop()