The following code works great on Windows, but fails on
Ubuntu 6.10.
<test.py>
#!/usr/bin/python
"""
Works with:
PythonCard version: 0.8.2
wxPython version: 2.6.3.3
Python version: 2.5 (r25:51908, Sep 19 2006, 09:52:17)
[MSC v.1310 32 bit (Intel)]
Platform: win32
Buggy with:
PythonCard version: 0.8.2
wxPython version: 2.6.3.2
Python version: 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)]
Platform: linux2
Bugs:
(1) Gauge value & Textarea text are not updated.
(2) Slider size shrinks; ticks don't show up; slider
doesn't hop but changes continuously (seems as if it
were not int).
"""
from PythonCard import model
import time
class a:
def __init__(self):
self.gui = None # for GUI
def doit(self):
self.gui.log("Text not updated")
for i in range(10):
self.gui.log(str(i))
self.gui.progress(float(i + 1) / 10)
print "Whoa! Not updated...", i
time.sleep(0.5)
class gui(model.Background):
def on_initialize(self, event):
self.a = a()
self.a.gui = self
def progress(self, ratio):
value = ratio * self.components.DataProgress.max
self.components.DataProgress.value = value
def log(self, s):
self.components.Log.appendText(s + '\n')
def on_Button_mouseClick(self, event):
self.a.doit()
if __name__ == '__main__':
app = model.Application(gui)
app.MainLoop()
# end of file
companion rsrc file