我想制作一个带有上传量规的上传程序。我有一个回调函数:
def myupdater(self, current, total):
m = (Decimal(current)/Decimal(total))
print "uploaded {0}/{1} so far".format(current, total)
self.gauge_1.SetValue(m)
print(m)
print (self.gauge_1.GetValue)
wx.Yield()
print"----------------------"
它显示(仪表最后仅更改为 100%):
最佳答案
Gauge
's range is int type.传递小于 1 的值将被视为 0。按如下所示更改 gauge_1 ..
行:
self.gauge_1 = wx.Gauge(self.notebook_1_pane_1, -1, 100)
更改myupdater
如下:
def myupdater(self, current, total):
m = 100 * current / total
self.gauge_1.SetValue(m)
wx.Yield()
关于python - Wxpython的仪表不刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17253283/