class AlfabetoWidget(QWidget): def __init__(self): super().__init__() self.principal = QGridLayout() self.label = QLabel("Alfabetos") self.principal.addWidget(self.label, 0, 0) self.input = QLineEdit() self.input.setPlaceholderText("Ingrese el alfabeto") self.input.setClearButtonEnabled(True) self.principal.addWidget(self.input, 1, 0) self.button_add = QPushButton("Add") self.principal.addWidget(self.button_add, 1, 1) self.button_add.clicked.connect(self.texto) self.button_union = QPushButton("Union") self.principal.addWidget(self.button_union, 2, 0) self.button_diff = QPushButton("Diferencia") self.principal.addWidget(self.button_diff, 3, 0) self.button_inter = QPushButton("Interseccion") self.principal.addWidget(self.button_inter, 4, 0) self.setLayout(self.principal) def texto(self): res = "texto ingresado: " + self.input.displayText() print(res)
class LenguajeWidget(QWidget): def __init__(self): super().__init__() self.principal = QGridLayout() self.label = QLabel("Lenguajes") self.principal.addWidget(self.label, 0, 0, 1, 1) self.input = QLineEdit() self.principal.addWidget(self.input, 0, 1, 1, 1) self.button1 = QPushButton("Submit") self.principal.addWidget(self.button1, 0, 2, 1, 1) self.button1.clicked.connect(self.texto) self.setLayout(self.principal) def texto(self): res = "texto ingresado: " + self.input.displayText() print(res)