0

I'd like to use Qt's virtual keyboard (Qt5.11.1 or newer?) in my python3 (3.6) project on Win10, but I'm stuck. I have anaconda environment and I'm quite sure the Virtual keyboard is also somewhere in there, because I can find some folders with correct name.

What should the main program look like, besides the obvious, to virtual keyboard pop up when an input widget gets selected?

import sys
from qtpy.QtWidgets import QApplication, QDialog, QVBoxLayout, QSpinBox


class Test(QDialog):

    def __init__(self):
        super(Test, self).__init__()

        layout = QVBoxLayout()
        self.setLayout(layout)

        for i in range(2):
            layout.addWidget(QSpinBox())


if __name__ == '__main__':
    import os

    os.environ["QT_IM_MODULE"] = "qtvirtualkeyboard"
    app = QApplication(sys.argv)
    dialog = Test()
    sys.exit(dialog.exec())

edit: to be clear, i don't want to reinvent or customize the wheel, just use it.

Luka
  • 1
  • 3
  • What version of PyQt5 do you have? In my case the virtualkeyboard opens only when the cursor is placed in the QSpinBox but the bad thing is that it does not write anything since it seems that the buttons are disabled, in your case does the same thing happen? – eyllanesc Oct 02 '18 at 19:20
  • nothing happens, the keyboard does not even pop out. Should I prepare a QuickWidget for it? It's version 5.11.1.... too early perhaps? It came together wich anaconda. – Luka Oct 03 '18 at 20:04
  • Are you sure you are using PyQt5 5.11.1? What is your OS? I have tested it on Linux with PyQt5 5.11.2. On the other hand, use `@eyllanesc` to notify me of your message. – eyllanesc Oct 03 '18 at 21:09
  • @eyllanesc, I'm using Win10 and qtpy package. Printing QT_VERSION says 5.11.1 and that's only Qt installation I have on my system:) I found this folder: C:\ProgramData\Anaconda3\Library\qml\QtQuick\VirtualKeyboard, so it's gotta be somewhere. Mind sharing MWE of what you've got, I run it? – Luka Oct 04 '18 at 07:02

0 Answers0