Tkinter md5 problem
Dagur Páll Ammendrup
dagurp at heimsnet.is
Sat Dec 28 07:57:20 EST 2002
More information about the Python-list mailing list
Sat Dec 28 07:57:20 EST 2002
- Previous message (by thread): Tkinter md5 problem
- Next message (by thread): Tkinter md5 problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi!
In the Introduction to Tkinter I found this method to detect if the
contents in a Text widget have changed:
---------------------------------------------------
import md5
def getsignature(contents):
return md5.md5(contents).digest()
text.insert(END, contents) # original contents
signature = getsignature(contents)
...
contents = text.get(1.0, END)
if signature != getsignature(contents):
print "contents have changed!"
---------------------------------------------------
This does work, but only if you're using ASCII, otherwise you get a
UnicodeError
UnicodeError: ASCII encoding error: ordinal not in range(128)
So what can I do?
Thanks in advance!
-Dagur
- Previous message (by thread): Tkinter md5 problem
- Next message (by thread): Tkinter md5 problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list