HandWriteRecognition.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:pyqt5 作者: yurisnm 项目源码 文件源码
def init_ui(self):
        self._fileDialog = QFileDialog(self)
        self._v_layout = QVBoxLayout()
        self._v_layout.setSpacing(2)
        self.setLayout(self._v_layout)
        self._path = "TEXT.png"
        self._pixmap = QPixmap(self._path)
        self._btnFile = QPushButton("Open")
        self._hWidget = QWidget()
        self._hLayout = QHBoxLayout()
        self._hWidget.setLayout(self._hLayout)

        self._image = Image.open(self._path)
        self._line = QLineEdit()

        self._hLayout.addWidget(self._btnFile)
        self._hLayout.addWidget(self._line)
        size = QSize(160, 90)
        pix = self._pixmap.scaled(size, transformMode=Qt.SmoothTransformation)

        self._lbl = QLabel()
        self._lbl.setPixmap(pix)
        self._v_layout.addWidget(self._lbl)
        self._v_layout.addWidget(self._hWidget)
        self._btnFile.clicked.connect(self.openFilePressed)

        self._line.setText(pytesseract.image_to_string(Image.open('TEXT.png')))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号