Hi,
I am using Fedora 32 with Gnome-shell desktop and wxPython 4.1.1 on Python3.8.7.
My application uses several different dialogs with text input and I have two different keyboard layouts installed EN and CS.
When I open the main application frame the keyboard is switched to one layout lets say it is CS, but when I open any dialog the layout goes back to EN.
I have an option to allow different layouts for each window enabled in the system menu. This means that the system remembers the layout for each program. This does have an effect on the behavior of the wxpython app. When I turn this feature off the same layout remains everywhere.
Is there any way of making the whole wxpython app keep one layout without switching this feature off in the system?
Here is a simple code to test it out.
You need to have two different keyboard layouts installed and switch to the non-default one before clicking the dialog button.
Thanks.
import wx
class Example(wx.Frame):
def __init__(self, *args, **kwargs):
super(Example, self).__init__(*args, **kwargs)
self.SetSize((350, 250))
self.Center()
self.SetTitle('Keyboard test')
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.text = wx.TextCtrl(self, -1)
self.button = wx.Button(self, wx.ID_OPEN, 'Dialog')
self.sizer.Add(self.text, flag=wx.EXPAND)
self.sizer.Add(self.button, flag=wx.EXPAND)
self.SetSizer(self.sizer)
self.Bind(wx.EVT_BUTTON, self._dialog, self.button)
def _dialog(self, event) -> None:
dialog = wx.TextEntryDialog(self, 'test', caption='test')
dialog.ShowModal()
dialog.Destroy()
if __name__ == '__main__':
app = wx.App()
ex = Example(None)
ex.Show()
app.MainLoop()