1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| import sys
from PyQt5.QtWidgets import*
from PyQt5.QtCore import*
from PyQt5.QtGui import*
########################################################################################
class MyButton1(QPushButton):
def __init__(self,text=None,x=0,y=0,width=10,height=5):
super().__init__()
self.text = text
self.x = x
self.y = y
self.width = width
self.height = height
btn = QPushButton(fen)
btn.setText(self.text)
btn.setGeometry(self.x,self.y,self.width,self.height)
btn.setStyleSheet("background-color:pink; \
color:Blue; \
border-width:2px; \
border-radius:20px; \
border-color:blue; \
border-style:solid; \
font: bold 28px;");
def copy():
t = textbox.text()
lbl.setText(t)
if __name__=="__main__":
app = QApplication(sys.argv)
fen = QWidget()
btn = MyButton1("Ouvrir", 100, 250, 250, 50)
btn.clicked.connect(copy)
textbox = QLineEdit(fen)
textbox.setGeometry(100,100,250,40)
textbox.setStyleSheet("background-color: ivory; \
color:blue; \
font: bold 25px; \
border-style: solid; \
border-width:1px; \
border-radius: 5px; \
border-color:blue; ");
lbl = QLabel(fen)
lbl.setGeometry(100, 150, 250, 40)
lbl.setText("merci")
lbl.show()
fen.show()
sys.exit(app.exec_()) |
Partager