全球今日报丨气轻PyQt6 33 多行文本框(QTextEdit)

from PyQt6.QtWidgets import *

from PyQt6.QtGui import QFont

import sys


(相关资料图)

class PyQt633(QWidget):

def __init__(self):

super().__init__()

self.initUI()

def initUI(self):

self.setWindowTitle('气轻PyQt6')                # 设置窗口标题

self.resize(520, 300)                           # 设置窗口大小

self.edit1 = QTextEdit(self)                    # 输入框

self.edit1.setGeometry(10, 0,500, 120)          # 设置位置和大小

self.edit1.setText('QTextEdit是多行文本框,\nQLineEdit是单行文本框。')

self.edit1.setFont(QFont('Arial',20))

self.edit1.setStyleSheet('background-color:#F5DEB3;color : #8B8682; \

font: bold large /"SimSun/";font-size:26px')

self.edit2 = QTextEdit(self)                    # 输入框

self.edit2.setGeometry(10, 130,500, 120)        # 设置位置和大小

self.edit2.setFont(QFont('Arial',20))

self.edit2.setStyleSheet('background-color:#00E5EE;color : #1E90FF; \

font: bold large /"SimSun/";font-size:26px')

self.btn = QPushButton('移动', self)

self.btn.setGeometry(230, 260, 60, 40)

self.btn.setStyleSheet('background-color:#96CDCD;color : #FFE4C4; \

font: bold large /"SimSun/";font-size:16px')

self.btn.clicked.connect(self.updateEdit)

self.show()

def updateEdit(self):

edittext = self.edit1.toPlainText()

self.edit1.clear()

self.edit2.setText(edittext)

if __name__ == '__main__':

app = QApplication(sys.argv)

window = PyQt633()

sys.exit(app.exec())

执行结果

标签:

点豆腐脑的内酯是什么哪里有卖的_豆腐脑是咸的还是甜的属于什么弹幕
<< 上一篇
最后一页
下一篇 >>
  • 精心推荐