"Olrik Lenstra" <[EMAIL PROTECTED]> wrote
I tried something (Posted below) but it doesn't work.
Closer but....
class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
...
panel = wx.Panel(self, -1)
wx.Gauge(panel, -1, 50, (50, 30), (200, 20))
You need to store a referemce to the guage otherwise you
cannot access it later
self.myGauge = wx.Gauge(panel....)
def onScan(self, event):
self.myfile = open('foo.txt')
self.count = 0
self.setTimer(0.01, self.processLine)
def processLine(self):
line = self.myfile.readline()
if line:
processLine(line)
This function needs to be defined somewhere obviously!
It is a global function not a method of your class.
self.count += 1
self.myGauge.setValue(count)
And now you access the attribute you created in __init__ above...
self.setTimer(0.01, self.processLine)
else:
self.myGuage.setValue(0)
Apart from not storing a reference to the gauge it was
OK, or at least very close, I think.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor