[Tkinter-discuss] Weird bug in input widgets?
Raphaël SEBAN
motus at laposte.net
Sat Jan 31 09:20:06 CET 2015
Hi all,
While working on my latest software (tkScenarist on GitHub), I
encountered a really weird issue: once cleared, input widgets such as
Text, Entry, ttk.Entry do *NOT* accept composite-accented letters
(french ê, ë, etc) any more.
So, to get sure, I made the following test code:
[CODE]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from tkinter import *
def clear_all (event=None):
# clear stringvars
for svar in cvars:
svar.set("")
# end for
# clear text widgets
for wtext in texts:
wtext.delete("1.0", END)
# end for
# end def
def test (nb_of_widgets):
global root, cvars, texts
root = Tk()
root.title("test #{}".format(nb_of_widgets))
cvars = list()
for n in range(nb_of_widgets):
svar = StringVar()
cvars.append(svar)
Entry(root, textvariable=svar).pack()
# end for
texts = list()
for n in range(nb_of_widgets):
wtext = Text(root, height=2, width=20)
wtext.pack()
texts.append(wtext)
# end for
Button(root, text="Clear all", command=clear_all).pack(side=LEFT)
Button(root, text="Quit", command=root.destroy).pack(side=RIGHT)
# events main loop
root.mainloop()
# end def
if __name__ == "__main__":
# launch test series
for n in range(1, 4):
test(n)
# end for
# end if
[/CODE]
Detailed description of the issue:
* French keyboards are arranged in such a way that you must compose
accented letters as ê (e circumflex) or ë (e diaeresis) by pressing
first the '^' key and then the letter to compose with (e.g. a, e, i, o,
u, y) in order to get the final composite-accented letter (â, ä, ê, ë,
and so on);
* when you launch the test script (cited above) and then type, let's
say, the e circumflex letter (ê) into the Entry widget and into the Text
widget, respectively:
* the first time, you'll get the right letters inserted into the input
widgets;
* then click on 'Clear all' button and enter once again the same
composite-accented letter into *ALL* the input widgets;
* secund time, only the last pack()-ed input widget will get the right
input, all other widgets will show unaccented letters;
* the test script tries with 1 Entry and 1 Text input widgets, then with
2 input widgets and finally with 3 input widgets;
* each time you get the same issue: only the last pack()-ed input widget
shows the right input letter, all the rest showing unaccented letters.
This issue is quite embarrassing for me as my latest software manages
with movie scenario scriptwriting, which *MUST* be written with correct
accents in French, otherwise all the purpose of the software would collapse.
Is this a known issue?
Thank you for your expert advice.
Regards.
Raphaël SEBAN alias tarball69.
More information about the Tkinter-discuss
mailing list