New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVT_KEY_DOWN is not called for a non-English keyboard layout in Linux #1144

Closed
Jenyay opened this Issue Jan 16, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@Jenyay
Copy link
Contributor

Jenyay commented Jan 16, 2019

Operating system: Ubuntu 18.10
wxPython version & source: wxPython 4.0.4 self-build.
Python version & source: Python 3.6 stock

Description of the problem: EVT_KEY_DOWN is not called for a non-English keyboard layout (Russian layout for example) in Linux for TextCtrl and StyledTextCtrl. The problem is observed in Ubuntu, everything works under Windows.

Code for test:

# -*- coding: utf-8 -*-

import wx
import wx.stc


class MyFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "Key test")
        self.SetSize((600, 500))

        self.textCrl = wx.TextCtrl(self, style=wx.TE_MULTILINE)
        self.styledTextCtrl = wx.stc.StyledTextCtrl(self)
        self.logCtrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE)

        self.textCrl.Bind(wx.EVT_KEY_DOWN, handler=self._onTextCtrlKeyDown)
        self.styledTextCtrl.Bind(wx.EVT_KEY_DOWN, handler=self._onStyledTextCtrlKeyDown)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.textCrl, 1, wx.EXPAND)
        sizer.Add(self.styledTextCtrl, 1, wx.EXPAND)
        sizer.Add(self.logCtrl, 1, wx.EXPAND)
        self.SetSizer(sizer)

    def _onTextCtrlKeyDown(self, event):
        text = '[TextCtrl] EVT_KEY_DOWN. Key code = {}\n'.format(event.GetKeyCode())
        self.logCtrl.AppendText(text)
        event.Skip()

    def _onStyledTextCtrlKeyDown(self, event):
        text = '[StyledTextCtrl] EVT_KEY_DOWN. Key code = {}\n'.format(event.GetKeyCode())
        self.logCtrl.AppendText(text)
        event.Skip()


if __name__ == '__main__':
    app = wx.App(0)

    frame = MyFrame(None)
    app.SetTopWindow(frame)
    frame.Show()

    app.MainLoop()

Screenshot in Ubuntu (5 characters were entered, 2 events were triggered.):

evt_key_down

@swt2c

This comment has been minimized.

Copy link
Contributor

swt2c commented Jan 26, 2019

I can reproduce in wxWidgets. It has been reported before also:
https://trac.wxwidgets.org/ticket/18054

@swt2c

This comment has been minimized.

Copy link
Contributor

swt2c commented Jan 27, 2019

Pull request opened with fix:
wxWidgets/wxWidgets#1186

swt2c added a commit to swt2c/Phoenix that referenced this issue Jan 28, 2019

swt2c added a commit to swt2c/Phoenix that referenced this issue Jan 30, 2019

@RobinD42

This comment has been minimized.

Copy link
Member

RobinD42 commented Feb 3, 2019

Fixed by #1150

@RobinD42 RobinD42 closed this Feb 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment