level 3
END🍒
楼主
import sys
from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication
from PyQt5.QtWidgets import (QWidget, QPushButton, QLineEdit,
QInputDialog, QApplication)
import sys
from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5.QtGui import QPainter, QColor, QPen
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication
count=0
class Example(QMainWindow):
global count
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
btn1 = QPushButton('箭头', self)
btn1.move(20, 20)
btn1.clicked.connect(self.paintEvent)
btn2 = QPushButton('FC', self)
btn2.move(20, 60)
btn2.clicked.connect(self.paintEvent)
btn3 = QPushButton('Bi-LSTM', self)
btn3.move(20, 100)
btn3.clicked.connect(self.paintEvent)
btn4 = QPushButton('hidden units', self)
btn4.move(20, 140)
btn4.clicked.connect(self.paintEvent)
btn5 = QPushButton('设置', self)
btn5.move(118, 60)
btn5.clicked.connect(self.showDialog)
btn6 = QPushButton('设置', self)
btn6.move(118, 100)
btn6.clicked.connect(self.showDialog)
btn7 = QPushButton('设置', self)
btn7.move(118, 140)
btn7.clicked.connect(self.showDialog)
self.statusBar()
self.setGeometry(300, 300, 290, 150)
self.setWindowTitle('Input dialog')
self.show()
def showDialog(self):
text, ok = QInputDialog.getText(self, 'Input Dialog',
'Enter row*column:')
if ok:
self.le.setText(str(text))
def paintEvent(self,e):
qp = QPainter()
qp.begin(self)
self.drawRe(qp,200,200,20,20)
qp.end()
def drawRe(self, qp,a,b,c,d):
pen = QPen(Qt.black, 2, Qt.SolidLine)
qp.setPen(pen)
qp.drawRect(a,b,c,d)
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
2019年04月14日 15点04分
1
from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication
from PyQt5.QtWidgets import (QWidget, QPushButton, QLineEdit,
QInputDialog, QApplication)
import sys
from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5.QtGui import QPainter, QColor, QPen
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication
count=0
class Example(QMainWindow):
global count
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
btn1 = QPushButton('箭头', self)
btn1.move(20, 20)
btn1.clicked.connect(self.paintEvent)
btn2 = QPushButton('FC', self)
btn2.move(20, 60)
btn2.clicked.connect(self.paintEvent)
btn3 = QPushButton('Bi-LSTM', self)
btn3.move(20, 100)
btn3.clicked.connect(self.paintEvent)
btn4 = QPushButton('hidden units', self)
btn4.move(20, 140)
btn4.clicked.connect(self.paintEvent)
btn5 = QPushButton('设置', self)
btn5.move(118, 60)
btn5.clicked.connect(self.showDialog)
btn6 = QPushButton('设置', self)
btn6.move(118, 100)
btn6.clicked.connect(self.showDialog)
btn7 = QPushButton('设置', self)
btn7.move(118, 140)
btn7.clicked.connect(self.showDialog)
self.statusBar()
self.setGeometry(300, 300, 290, 150)
self.setWindowTitle('Input dialog')
self.show()
def showDialog(self):
text, ok = QInputDialog.getText(self, 'Input Dialog',
'Enter row*column:')
if ok:
self.le.setText(str(text))
def paintEvent(self,e):
qp = QPainter()
qp.begin(self)
self.drawRe(qp,200,200,20,20)
qp.end()
def drawRe(self, qp,a,b,c,d):
pen = QPen(Qt.black, 2, Qt.SolidLine)
qp.setPen(pen)
qp.drawRect(a,b,c,d)
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
