#-*- coding: utf -8 -*-
from PyQt5.QtWidgets import QApplication,QMainWindow
from PyQt5.QtWidgets import *
import sys
class Ventana(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.resize(800,600)
groupbox = QGroupBox("Ejemplo",self)
groupbox.resize(600,400)
groupbox.move(100,100)
groupbox.setAutoFillBackground(True)
groupbox.setStyleSheet("background-color: white; border: 3px solid gray ")
frame = QFrame(groupbox)
frame.resize(300,200)
frame.move(150,100)
frame.setStyleSheet('background: rgb(235,225,190);border : 2px solid red')
self.boton1= QPushButton("Boton 1",frame)
self.boton1.move(150,100)
self.boton1.setStyleSheet('background: rgb(255,255,255);border : 2px solid blue')
self.boton1.clicked.connect(self.imprimir)
self.boton2= QPushButton("Boton 2",groupbox)
self.boton2.move(50,50)
self.boton2.clicked.connect(self.imprimir)
self.boton3= QPushButton("Boton 3",self)
self.boton3.move(50,50)
self.boton3.clicked.connect(self.imprimir)
def imprimir(self):
btn_txt = self.sender().text()
print("Presionaste: " ,btn_txt)
app=QApplication(sys.argv)
Form_principal = Ventana()
Form_principal.show()
app.exec_()