[PythonCE] Data fields don't update, they replace?

Stewart Midwinter stewart.midwinter at gmail.com
Tue Feb 1 00:54:55 CET 2005


Strange behaviour observed with Tkinter on PythonCE.  I've attached a
simple helloworld.py that demonstrates the behaviour.

This little app simply displays 'hello, world!' in a label.  If you
press the Update button, the text changes to 'goodbye, world.' using
the config method.  In real life, you might have a worker thread that
is monitoring some process, and the GUI periodically updates itself.

If I run this app on my desktop, it works as I expect.  But when I run
it on the PocketPC, what happens when I press the Update button is
that the whole root window is duplicated, with the new text appearing
in the new root window.  The old root window can be found hiding
underneath.

Has anyone else noted this behaviour?  If so, how do you work around it?

thanks,
-- 
Stewart Midwinter
stewart at midwinter.ca
stewart.midwinter at gmail.com
-------------- next part --------------
import os
OS = os.name.lower()
if OS == 'ce':
    import pythonrc     #contains the sys.path.append() commands
from Tkinter import Tk, Label, Button
import sys
root = Tk()
width = 240; height = 100
x = 0; y = 50
geometry = '%sx%s+%s+%s' % (width,height,x,y)
root.wm_geometry(geometry)
l = Label(root, text = 'hello, world!')
l.pack()
b = Button(root, text = 'quit', command = sys.exit)
def up():
    l.config(text='goodbye, world.')
    l.update()
u = Button(root, text = 'update', command = up)
b.pack()
u.pack()
root.mainloop()


More information about the PythonCE mailing list