Important: Please read the Qt Code of Conduct -

How to implement virtual keyboard with PySide2 and QML

  • I am developing an application where logic is written in python using PySide2 and UI part is written in QML. The application is bound to run on Raspberry Pi and has a requirement of the on-screen keyboard. However, I am not able to find any suitable approach to develop it for this setup.
    I have tried using the QML Virtual Keyboard class but for some reason, it always returns the following error whenever I try to run the example code on the device, even though all the python bindings and QML modules are installed.

    module "QtQuick.VirtualKeyboard" is not installed 

    Besides this, I didn't find any suitable approach to build this with PySide2 and QML. I have one idea in mind which involves developing the UI for keyboard in QML using GridLayout class and interfacing it with python using some sort of available mechanisms but I don't know if it's feasible or not.
    Can anyone guide me to a good approach ?


  • Lifetime Qt Champion

    @RG97 Did you install "Qt Virtual Keyboard"?

  • Hi
    Yes I have installed qml-module-qtquick-virtualkeyboard module,still it gives me the error whenever I try to import the module in QML file.

  • Lifetime Qt Champion

    @RG97 You need the keyboard installed on your Raspberry Pi.
    And I think you need to import with a version number like shown here

  • @jsulm I installed the on-screen keyboard and trued importing the version as given in example along with several other ones, but still no luck.

  • Hello! I have the absolutly same problem. Do you mean that you have installed qml-module-qtquick-virtualkeyboard via qt maintenance tool or it's additional library to pySide?

  • try to add this to

    import os
    os.environ["QT_IM_MODULE"] = "qtvirtualkeyboard"