Thursday 15 August 2013

python - Wxpython's gauge not refreshing -


I want to create an upload program with uploading gauges. I have a function that is a callback function: < Pre> def myupdater (auto, current, total): m = (decimal (current) / decimal (total)) print "upload {0} / {1} so far". Format (current, total) self.gauge_1.SetValue (m) Print (m) Print (self.gauge_1.GetValue) wx.Yield () Print "---------- ------- ----- "

and it shows (gauge changes only at the end of 100%):

Full code: < / P>

Passing less than 1 value is considered to change 0. Follow as gauge_1 .. line:

  self.gauge_1 = wx.Gauge (self.notebook_1_pane_1, -1, 100)   

Change myupdater as follows:

  def myupdater (auto, current, total): m = 100 * current / total self.gauge_1 .SetValue (m) wx.Yield ()    

No comments:

Post a Comment