4

I have a Tkinter Entry widget and a Hungarian keyboard. When I press the ő button on the keyboard, the Entry widget displays õ. ű becomes û. (I haven't had this problem in other applications since Windows 3.1.)

Edit:

I do have two language settings on this computer and when I start changing them around, the problem disappears.

screenshot

What can I do to make Tkinter handle my input correctly?

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
marczellm
  • 1,224
  • 2
  • 18
  • 42
  • What we really need to hunt this down is the log of exactly what `WM_INPUTLANGCHANGE` events were sent and what the `lParam` and `wParam` fields were when the problem occurred. – Donal Fellows Nov 19 '17 at 09:09
  • @DonalFellows Does Windows send *initial* `WM_INPUTLANGCHANGE` events to the application? Because the problem only occurred before I started changing the languages. – marczellm Nov 20 '17 at 15:02

3 Answers3

0

It looks like it is a problem with changes to the keyboard layout, as Tk (the library under Tkinter) on Windows doesn't do anything with the lParam in the the WM_INPUTLANGCHANGE messages. That's a bug.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
0

There is a Tk ticket here: Tk Ticket

Unfortunately, the issue might be TkInter only.

Would it be possible to get more details and make a test using plain Tcl/Tk ? So, download a current tcl/tk starkit or distribution and try the script:

pack [entry .e]

and look, if the problem is present there too ?

Please report to the tk ticket, anonymous login might be required there.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
  • Yes, the issue is present there too. – marczellm Nov 15 '17 at 12:34
  • I don't believe this can be a Tkinter only issue; Tkinter is a Python binding layer on top of Tcl/Tk (unlike PerlTk) and doesn't introduce any place where it would intercept or misinterpret messages in a way characteristic of this bug. If it was a binding-layer issue, _lots_ of non-ASCII characters would come out wrong. – Donal Fellows Nov 19 '17 at 12:14
-2

Can't reproduce your problem. Works for me with Tk and tkinter as well. See the Tk ticket.

  • 3
    Welcome to Stack Overflow! This is really a comment, not an answer. With a bit more rep, [you will be able to post comments](//stackoverflow.com/privileges/comment). For the moment I've added the comment for you, and I'm flagging this post for deletion. – Adriaan Nov 15 '17 at 20:58
  • In my case the keyboard layout does not change! Also the issue is present _initially_ but disappears after changing the _language_ and can not be brought back. – marczellm Nov 15 '17 at 22:14