Tk Source Code

View Ticket
Login
Ticket UUID: 51a90593b60706315052c1a7c8f3a26a9c0ed2b3
Title: Weird bug in input widgets?
Type: Bug Version: 8.6
Submitter: tarball69 Created on: 2015-02-02 12:01:07
Subsystem: 84. Unix Build Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Pending Last Modified: 2026-10-08 13:58:44
Resolution: None Closed By: nobody
    Closed on:
Description:
Hi all,

I'm working on Ubuntu 14.10, Tkinter/Tk 8.6 for Python3, no specific tuning, distro defaults.

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.
User Comments: serhiy.storchaka added on 2026-10-08 13:58:44:

I could not reproduce this on X11 with the built-in input method of Xlib (fr_FR.UTF-8, dead circumflex key), with Tk 8.6.2, 8.6.4, 8.6.18, 9.0.5 and 9.1: after clearing, the composed characters are entered in all entries and texts. Was an input method such as IBus in use? Since [5d52ad92fa] the input contexts are created differently. Does this still happen with a current Tk?


dgp added on 2015-05-08 16:00:26:
Is there any chance a Tcl script demonstrating the
issue can be contributed?  Presenting the issue in
Python greatly reduces the already tiny population
who might hope to examine the matter.

The report seems to suggest this is a new behavior
not seen in some earlier releases of Tk ?  Can
that be quantified?  The finest detail would be very
helpful, but even isolating to the release patchlevel
would be good.  The development history of Tk
is found here:

http://core.tcl.tk/tk/