Я новичок в PyQt5 и Python. У меня вопрос, как включить горизонтальную полосу прокрутки, если пользователь вводит больше данных в одной строке поля ввода?
В настоящее время поле ввода включает вертикальное полоса прокрутки, если вы вводите больше данных.
может ли кто-нибудь помочь мне, как включить как горизонтальную, так и вертикальную полосу прокрутки, если пользователь вводит больше данных?
Текущий Python Код:
import sys
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import QSize
from PyQt5.QtWidgets import *
from PyQt5.QtWidgets import QApplication, QWidget, QInputDialog, QLineEdit, QFileDialog
from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel
class MainWindow(QMainWindow, QWidget):
def __init__(self):
QMainWindow.__init__(self)
self.height = 480
self.width = 640
self.top = 10
self.left = 10
self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint)
self.setMinimumSize(QSize(800, 600))
self.setWindowTitle("My Windows")
# .... other Code here
# Edit Box
input_et_box = QFrame(self)
input_et_box.resize(300, 450)
input_et_box.move(50, 80)
layout = QHBoxLayout(input_et_box)
self.textEdit = QTextEdit(self)
layout.addWidget(self.textEdit)
# If we enter more data in Edit Box it will automatically enabled Vertical Scroll bar but Horizontal Scroll bar is not enabling automatically
# bar is not enabling
def printHello(self):
print("Hello")
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
layout = QGridLayout()
mainWin = MainWindow()
mainWin.show()
sys.exit(app.exec_())
Снимок:
![enter image description here](https://i.stack.imgur.com/wWHCj.png)
![enter image description here](https://i.stack.imgur.com/gtJng.png)