How to modify the size of the virtual keyboard? And as far as possible, the drag and drop option is allowed. Also, since there is no escape key, I cannot get the virtual keyboard once it is displayed. Can you do something about it? My application runs on a kiosk-type terminal, with a touch screen, no mouse, and no physical keyboard. I am using Python 3.8.10 on ubuntu 20.04.3 LTS. Here is a part of my code...
import sys
import os
os.environ["QT_IM_MODULE"] = "qtvirtualkeyboard"
from PySide6 import QtCore, QtGui, QtWidgets
from PySide6.QtWidgets import *
from PySide6.QtGui import *
from PySide6.QtCore import *
class MainApp(QMainWindow):
def __init__(self, parent=None, *args):
super(MainApp, self).__init__(parent)
self.setFixedSize(1600, 1000)
self.button = QPushButton(self)
self.button.setGeometry(20, 20, 140, 30)
self.button.setText("Show Dialog")
self.button.clicked.connect(self.show_dialog)
def show_dialog(self):
self.dialog = Dialog()
self.dialog.show()
class Dialog(QDialog):
def __init__(self):
QDialog.__init__(self)
self.setFixedSize(600, 550)
self.move(500, 200)
self.setWindowFlags((Qt.FramelessWindowHint))
self.setStyleSheet("background-color: rgba(57, 239, 255, 100)")
self.label = QLabel(self)
self.label.setGeometry(0, 0, 600, 30)
self.label.setText("Login")
self.label.setAlignment(Qt.AlignCenter)
self.lbl_dni = QLabel(self)
self.lbl_dni.setGeometry(100, 150, 80, 30)
self.lbl_dni.setText("DNI")
self.lbl_dni.setObjectName("lbl_dni")
self.lbl_dni.setAlignment(Qt.AlignCenter)
self.lnet_dni = QLineEdit(self)
self.lnet_dni.setGeometry(250, 150, 100, 30)
self.lnet_dni.setObjectName("lnet_dni")
self.lnet_dni.setMaxLength(8)
self.lnet_dni.setAlignment(Qt.AlignCenter)
self.lbl_pass = QLabel(self)
self.lbl_pass.setGeometry(100, 300, 80, 30)
self.lbl_pass.setText("Password")
self.lbl_pass.setObjectName("lbl_pass")
self.lbl_pass.setAlignment(Qt.AlignCenter)
self.lnet_pass = QLineEdit(self)
self.lnet_pass.setGeometry(225, 300, 160, 30)
self.lnet_pass.setObjectName("lnet_pass")
self.lnet_pass.setMaxLength(20)
self.lnet_pass.setEchoMode(QtWidgets.QLineEdit.Password)
self.lnet_pass.setAlignment(Qt.AlignCenter)
self.btn_login = QPushButton(self)
self.btn_login.setGeometry(150, 450, 100, 24)
self.btn_login.setObjectName("btn_login")
self.btn_login.setText("Login")
self.btn_login.clicked.connect(self.login)
self.btn_cancel = QPushButton(self)
self.btn_cancel.setGeometry(350, 450, 80, 25)
self.btn_cancel.setObjectName("btn_cancel")
self.btn_cancel.setText("Cancel")
self.btn_cancel.clicked.connect(self.cancel)
def login(self):
print('do something')
def cancel(self):
self.close()
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainApp()
window.show()
app.exec()