声明:本文只作学习研究,禁止用于非法用途,否则后果自负,
如有侵权,请告知删除,谢谢!本人纯粹技术爱好,若侵犯贵公司的权益,请告知
class Demo(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.winows_info()
self.button_info()
self.text_info()
self.show()
def winows_info(self):
self.resize(600, 200)
self.setWindowTitle('ks直播源')
self.setWindowIcon(QIcon('001.ico'))
def button_info(self):
self.choose1 = QLabel('链接地址', self)
self.choose1.setGeometry(QtCore.QRect(10, 20, 120, 40))
self.choose1.setStyleSheet('QLabel{font-size:14px}')
okButton = QPushButton('确定', self)
okButton.setGeometry(QtCore.QRect(480, 20, 100, 40))
okButton.clicked.connect(self.okButton)
def text_info(self):
self.ql_a = QLineEdit(self)
self.ql_a.setGeometry(QtCore.QRect(80, 20, 380, 40))
self.ql_a.setStyleSheet('QLineEdit{font-size:14px}')
self.ql_b = QTextEdit(self)
self.ql_b.setGeometry(QtCore.QRect(10, 80, 580, 90))
self.ql_b.setStyleSheet('QTextEdit{font-size:16px}')
def closeEvent(self, event):
reply = QMessageBox.question(self, '提示', '退出?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if reply == QMessageBox.Yes:
event.accept()
else:
event.ignore()
def okButton(self):
url = self.ql_a.text()
if url:
flv_url = get_flv_url(url)
self.ql_b.setText(flv_url)
else:
QMessageBox.about(self, '错误', '链接有误!!')
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Demo()
sys.exit(app.exec_())