├── .gitattributes
├── .gitignore
├── 01-ventanas
├── icon.ico
└── ventana.py
├── 02-layout
├── absolute.py
├── box-layout.py
└── grid-layout.py
├── 03-eventos
└── events.py
├── 04-dibujar
├── image
│ ├── image.jpg
│ └── small_image.jpg
└── paint.py
├── 05_A-widgets
└── widgets.py
├── 06-items-views
└── item-view.py
├── 07-dialogs
└── dialogs.py
├── 08-qss
└── untitled.ui
├── 09-base de datos
└── database.py
├── 10-opencv
└── main.py
├── 11-web
└── web.py
├── 12-menu
└── menu.py
├── 13-multimedia
└── multimedia.py
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 |
7 | # Precompiled Headers
8 | *.gch
9 | *.pch
10 |
11 | # Compiled Dynamic libraries
12 | *.so
13 | *.dylib
14 | *.dll
15 |
16 | # Fortran module files
17 | *.mod
18 |
19 | # Compiled Static libraries
20 | *.lai
21 | *.la
22 | *.a
23 | *.lib
24 |
25 | # Executables
26 | *.exe
27 | *.out
28 | *.app
29 |
30 | # =========================
31 | # Operating System Files
32 | # =========================
33 |
34 | # OSX
35 | # =========================
36 |
37 | .DS_Store
38 | .AppleDouble
39 | .LSOverride
40 |
41 | # Thumbnails
42 | ._*
43 |
44 | # Files that might appear in the root of a volume
45 | .DocumentRevisions-V100
46 | .fseventsd
47 | .Spotlight-V100
48 | .TemporaryItems
49 | .Trashes
50 | .VolumeIcon.icns
51 |
52 | # Directories potentially created on remote AFP share
53 | .AppleDB
54 | .AppleDesktop
55 | Network Trash Folder
56 | Temporary Items
57 | .apdisk
58 |
59 | # Windows
60 | # =========================
61 |
62 | # Windows image file caches
63 | Thumbs.db
64 | ehthumbs.db
65 |
66 | # Folder config file
67 | Desktop.ini
68 |
69 | # Recycle Bin used on file shares
70 | $RECYCLE.BIN/
71 |
72 | # Windows Installer files
73 | *.cab
74 | *.msi
75 | *.msm
76 | *.msp
77 |
78 | # Windows shortcuts
79 | *.lnk
80 |
--------------------------------------------------------------------------------
/01-ventanas/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TutorProgramacion/pyqt-tutorial/67bdc86dc6e7251457487ed55b6901fae6a857c1/01-ventanas/icon.ico
--------------------------------------------------------------------------------
/01-ventanas/ventana.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | from PyQt5.QtCore import QCoreApplication
4 | from PyQt5.QtGui import QIcon
5 | from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
6 |
7 |
8 | if __name__ == '__main__':
9 | app = QApplication(sys.argv)
10 |
11 | w = QWidget()
12 | w.setWindowTitle('Ventana PyQT-5')
13 | w.setWindowIcon(QIcon('icon.ico'))
14 |
15 | btn = QPushButton('Este es un Button', w)
16 | btn.setToolTip('This is a QPushButton widget')
17 | btn.move(150, 50)
18 |
19 | btn.setIcon(QIcon('icon.ico'))
20 | btn.clicked.connect(QCoreApplication.instance().quit)
21 |
22 | w.resize(1280, 720)
23 | w.show()
24 |
25 | sys.exit(app.exec_())
26 |
--------------------------------------------------------------------------------
/02-layout/absolute.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QLineEdit
4 |
5 |
6 | if __name__ == '__main__':
7 | app = QApplication(sys.argv)
8 |
9 | w = QWidget()
10 | w.setWindowTitle('Layout PyQT-5')
11 | w.resize(250, 120)
12 |
13 | lblName = QLabel("Nombre:", w)
14 | lblName.move(20, 20)
15 |
16 | lblPass = QLabel("Contraseña:", w)
17 | lblPass.move(20, 50)
18 |
19 | txtName = QLineEdit(w)
20 | txtName.setPlaceholderText("Nombre de usuario")
21 | txtName.move(100, 15)
22 |
23 | txtPass = QLineEdit(w)
24 | txtPass.setPlaceholderText("Contraseña de usuario")
25 | txtPass.move(100, 45)
26 |
27 | btnLogin = QPushButton("Login", w)
28 | btnLogin.move(20, 80)
29 | btnLogin.resize(218, 30)
30 |
31 | w.show()
32 |
33 | sys.exit(app.exec_())
34 |
--------------------------------------------------------------------------------
/02-layout/box-layout.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout, QHBoxLayout
3 |
4 |
5 | if __name__ == '__main__':
6 | app = QApplication(sys.argv)
7 |
8 | w = QWidget()
9 | w.setWindowTitle('Layout PyQT-5')
10 | w.resize(250, 120)
11 |
12 | vbox = QVBoxLayout()
13 | vbox.setSpacing(20)
14 |
15 | for n in range(5):
16 | if n == 2:
17 | hbox = QHBoxLayout()
18 | for m in range(3):
19 | hbox.addWidget(QPushButton("Button #" + str(m)))
20 | vbox.addLayout(hbox)
21 | else:
22 | vbox.addWidget(QPushButton("Button #" + str(n)))
23 |
24 | w.setLayout(vbox)
25 | w.show()
26 |
27 | sys.exit(app.exec_())
28 |
--------------------------------------------------------------------------------
/02-layout/grid-layout.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel, QLineEdit, QGridLayout
4 |
5 |
6 | if __name__ == '__main__':
7 | app = QApplication(sys.argv)
8 |
9 | w = QWidget()
10 | w.setWindowTitle('Layout PyQT-5')
11 | w.resize(250, 120)
12 |
13 | lblName = QLabel("Nombre:")
14 | txtName = QLineEdit()
15 | txtName.setPlaceholderText("Nombre de usuario")
16 |
17 | lblPass = QLabel("Contraseña:")
18 | txtPass = QLineEdit(w)
19 | txtPass.setPlaceholderText("Contraseña de usuario")
20 |
21 | grid = QGridLayout()
22 | grid.addWidget(lblName, 0, 0)
23 | grid.addWidget(txtName, 0, 1)
24 | grid.addWidget(lblPass, 1, 0)
25 | grid.addWidget(txtPass, 1, 1)
26 |
27 | btnLogin = QPushButton("Login", w)
28 | grid.addWidget(btnLogin, 2, 0, 1, 2)
29 |
30 | w.setLayout(grid)
31 | w.show()
32 |
33 | sys.exit(app.exec_())
34 |
--------------------------------------------------------------------------------
/03-eventos/events.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PyQt5.QtCore import Qt
3 | from PyQt5.QtWidgets import QPushButton, QApplication, QMessageBox, QWidget
4 |
5 |
6 | class Example(QWidget):
7 | def __init__(self):
8 | super().__init__()
9 | self.initUI()
10 |
11 | def initUI(self):
12 | btn1 = QPushButton("Button 1", self)
13 | btn1.resize(150, 40)
14 | btn1.move(400 / 2 - 150 / 2, 200 / 2 - 40)
15 | btn1.clicked.connect(self.buttonClicked)
16 |
17 | btn2 = QPushButton("Button 2", self)
18 | btn2.resize(150, 40)
19 | btn2.move(400 / 2 - 150 / 2, 200 / 2)
20 | btn2.clicked.connect(self.buttonClicked)
21 |
22 | self.resize(400, 200)
23 | self.setMaximumSize(400, 200)
24 | self.setWindowTitle('Event PyQT5')
25 | self.show()
26 |
27 | def buttonClicked(self, e):
28 | btn_txt = self.sender().text()
29 | QMessageBox.information(self, 'Events - Slot', 'click en: ' + btn_txt)
30 |
31 | def closeEvent(self, event):
32 | reply = QMessageBox.question(self,
33 | 'Events - Slot',
34 | "Realmente desea cerrar la aplicacion",
35 | QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
36 |
37 | if reply == QMessageBox.Yes:
38 | event.accept()
39 | else:
40 | event.ignore()
41 |
42 | def keyPressEvent(self, event):
43 | if event.key() == Qt.Key_Escape:
44 | self.close()
45 |
46 |
47 | if __name__ == '__main__':
48 | app = QApplication(sys.argv)
49 | win = Example()
50 | sys.exit(app.exec_())
51 |
52 |
53 |
--------------------------------------------------------------------------------
/04-dibujar/image/image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TutorProgramacion/pyqt-tutorial/67bdc86dc6e7251457487ed55b6901fae6a857c1/04-dibujar/image/image.jpg
--------------------------------------------------------------------------------
/04-dibujar/image/small_image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TutorProgramacion/pyqt-tutorial/67bdc86dc6e7251457487ed55b6901fae6a857c1/04-dibujar/image/small_image.jpg
--------------------------------------------------------------------------------
/04-dibujar/paint.py:
--------------------------------------------------------------------------------
1 | __author__ = 'Carmelo Marin Abrego'
2 |
3 | import sys
4 |
5 | from PyQt5.QtGui import QPainter, QFont, QColor, QPixmap, QPen, QBrush
6 | from PyQt5.QtCore import Qt, QRect, QPoint
7 | from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
8 |
9 |
10 | class Example(QWidget):
11 | def __init__(self):
12 | super().__init__()
13 | self.initUI()
14 |
15 | def initUI(self):
16 | self.resize(1280, 720)
17 | self.setWindowTitle('PyQT5 Paint Event')
18 |
19 | def paintEvent(self, event):
20 | qp = QPainter()
21 | qp.begin(self)
22 | self.drawImage(event, qp, 'image/image.jpg')
23 | self.drawText(event, qp, 'Tutor de Programación\nPintar con PyQT5')
24 | self.drawPoint(event, qp)
25 | self.drawLine(event, qp)
26 | self.drawShape(event, qp)
27 | qp.end()
28 |
29 | def drawShape(self, event, qp):
30 | pen = QPen(Qt.yellow)
31 | pen.setWidth(3)
32 | # rellenar fondo con patron de imagen
33 | brush = QBrush()
34 | brush.setTexture(QPixmap('image/small_image.jpg'))
35 | # establecer el QBrush
36 | qp.setBrush(brush)
37 | qp.setPen(pen)
38 | qp.drawRoundedRect(QRect(50, 50, 200, 150), 15, 15)
39 | # utilizar un patron predefinido
40 | brush.setStyle(Qt.DiagCrossPattern)
41 | qp.setBrush(brush)
42 | qp.drawEllipse(350, 50, 150, 150)
43 |
44 | def drawPoint(self, event, qp):
45 | pen = QPen(Qt.red)
46 | pen.setWidth(10)
47 |
48 | qp.setPen(pen)
49 | qp.drawPoint(event.rect().width() / 2, event.rect().height() / 2)
50 |
51 | def drawLine(self, event, qp):
52 | pen = QPen()
53 | pen.setWidth(3)
54 | pen.setColor(QColor(128, 250, 25, 255))
55 | pen.setStyle(Qt.DotLine)
56 |
57 | qp.setPen(pen)
58 | qp.drawLine(QPoint(10, 10), QPoint(1280 - 10, 10))
59 |
60 | color = QColor()
61 | color.setNamedColor('#c2h6b4')
62 |
63 | pen.setColor(color)
64 | pen.setStyle(Qt.DashLine)
65 |
66 | qp.setPen(pen)
67 | qp.drawLine(QPoint(10, 10 + 20), QPoint(1280 - 10, 10 + 20))
68 |
69 |
70 | def drawImage(self, event, qp, image):
71 | pixmap = QPixmap(image)
72 | qp.drawPixmap(event.rect(), pixmap)
73 | # qp.drawPixmap(QRect(0, 0, 1280, 720), pixmap)
74 |
75 | def drawText(self, event, qp, text):
76 | qp.setPen(QColor(0, 255, 255))
77 | qp.setFont(QFont('Consolas', 48))
78 | qp.drawText(event.rect(), Qt.AlignCenter, text)
79 |
80 |
81 | if __name__ == '__main__':
82 | app = QApplication(sys.argv)
83 | win = Example()
84 | win.show()
85 | sys.exit(app.exec_())
86 |
87 |
88 |
--------------------------------------------------------------------------------
/05_A-widgets/widgets.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | from PyQt5.QtWidgets import QWidget, QApplication, QCheckBox, QLineEdit, QLabel, QSlider, QLCDNumber, QCalendarWidget, \
4 | QGroupBox, QRadioButton, QVBoxLayout
5 | from PyQt5.QtCore import Qt
6 |
7 |
8 | class Example(QWidget):
9 | def __init__(self):
10 | super().__init__()
11 | self.initUI()
12 |
13 | def initUI(self):
14 |
15 | self.addCheckBox()
16 | self.addLineEdit()
17 | self.addSlider()
18 | self.addCalendar()
19 | self.addRadioBoton()
20 |
21 | self.resize(640, 320)
22 | self.setWindowTitle('Controles PyQT 5 by Tutor de Programacion')
23 |
24 | def addRadioBoton(self):
25 | gbx = QGroupBox('Tu Lenguaje Favorito', self)
26 | gbx.setGeometry(20, 150, 185, 120)
27 | # crear tres QRadioButton
28 | radio1 = QRadioButton("C/C++")
29 | radio2 = QRadioButton("Python")
30 | radio3 = QRadioButton("Java")
31 | # agregar los widgets al layout vertical
32 | vbox = QVBoxLayout(self)
33 | vbox.addWidget(radio1)
34 | vbox.addWidget(radio2)
35 | vbox.addWidget(radio3)
36 | # establecer el layout del QGroupBox
37 | gbx.setLayout(vbox)
38 |
39 | # radio1.setChecked(True)
40 | # print(radio1.isChecked())
41 |
42 |
43 | def addCalendar(self):
44 | cal = QCalendarWidget(self)
45 | cal.setGridVisible(True)
46 | cal.clicked.connect(self.timeSelected)
47 | cal.move(300, 20)
48 |
49 | def timeSelected(self, date):
50 | print('La Fecha es: ', date.toString())
51 |
52 | def addSlider(self):
53 | sld = QSlider(Qt.Horizontal, self)
54 | # establecer posicion (x,y) y dimenciones (ancho, alto)
55 | sld.setGeometry(20, 80, 150, 30)
56 | # indicar rango de valores validos
57 | sld.setRange(50, 250)
58 | # establecer valor inicial
59 | sld.setValue(120)
60 | # evento producido cada vez que cambia el valor
61 | sld.valueChanged.connect(self.valChange)
62 |
63 | num = QLCDNumber(self)
64 | num.setGeometry(180, 80, 50, 30)
65 | # mostrar valor inicial
66 | num.display(sld.value())
67 | # cambiar valor QLCDNumber cuando cambiar QSlider
68 | sld.valueChanged.connect(num.display)
69 |
70 | def valChange(self, value):
71 | print('QSlider value: ', value)
72 |
73 | def addLineEdit(self):
74 | # crea un texto no es editable
75 | lbl = QLabel('Nombre:', self)
76 | lbl.move(20, 52)
77 |
78 | # crea un widget que permite editar una linea de texto
79 | txt = QLineEdit(self)
80 | txt.move(72, 50)
81 | # establece un texto informativo
82 | txt.setPlaceholderText('Dime tu nombre')
83 | # evento producido cada vez que cambia el texto
84 | txt.textChanged.connect(self.textChange)
85 | # establece el foco en el widget
86 | txt.setFocus()
87 | # obtiene el texto escrito
88 | nombre = txt.text()
89 |
90 | def textChange(self, text):
91 | print('El nuevo texto es: ', text)
92 |
93 |
94 | def addCheckBox(self):
95 | # Crear el widget
96 | cbx = QCheckBox('Mostrar/Ocultar', self)
97 | # Cambiar estado del CheckBox puede ser: Qt.PartiallyChecked, Qt.Checked, Qt.Unchecked
98 | cbx.setCheckState(Qt.PartiallyChecked)
99 | # Responder al evento de cambio de estado
100 | cbx.stateChanged.connect(self.cbxChange)
101 | # Ubicar el control en la posicion (x, y)
102 | cbx.move(20, 20)
103 |
104 | def cbxChange(self, state):
105 | print('CheckBox State: ', state)
106 |
107 |
108 | if __name__ == '__main__':
109 | app = QApplication(sys.argv)
110 | win = Example()
111 | win.show()
112 | sys.exit(app.exec_())
113 |
--------------------------------------------------------------------------------
/06-items-views/item-view.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | from PyQt5.QtCore import Qt
4 | from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QPushButton, QComboBox, QStyleFactory, QListWidget, \
5 | QTableWidget, QTableWidgetItem, QListWidgetItem
6 |
7 |
8 | class Example(QWidget):
9 | def __init__(self, parent=None):
10 | super(Example, self).__init__(parent)
11 | QApplication.setStyle(QStyleFactory.create('Fusion'))
12 |
13 | # -------------- QCOMBOBOX ----------------------
14 | cbx = QComboBox()
15 | # agregar lista de nombres de estilos disponibles
16 | cbx.addItems(QStyleFactory.keys())
17 | # responder al evento cambio de texto
18 | cbx.currentTextChanged.connect(self.textChanged)
19 | # seleccionar el ultimo elemento
20 | cbx.setItemText(4, 'Fusion')
21 |
22 | # -------------- QLISTWIDGET ---------------------
23 | items = ['Ubuntu', 'Linux', 'Mac OS', 'Windows', 'Fedora', 'Chrome OS', 'Android', 'Windows Phone']
24 |
25 | self.lv = QListWidget()
26 | self.lv.addItems(items)
27 | self.lv.itemSelectionChanged.connect(self.itemChanged)
28 |
29 | # -------------- QTABLEWIDGET --------------------
30 | self.table = QTableWidget(10, 3)
31 | # establecer nombre de cabecera de las columnas
32 | self.table.setHorizontalHeaderLabels(['Nombre', 'Edad', 'Nacionalidad'])
33 | # evento producido cuando cambia el elemento seleccionado
34 | self.table.itemSelectionChanged.connect(self.tableItemChanged)
35 | # alternar color de fila
36 | self.table.setAlternatingRowColors(True)
37 | # seleccionar solo filas
38 | self.table.setSelectionBehavior(QTableWidget.SelectRows)
39 | # usar seleccion simple, una fila a la vez
40 | self.table.setSelectionMode(QTableWidget.SingleSelection)
41 |
42 | table_data = [
43 | ("Alice", 15, "Panama"),
44 | ("Dana", 25, "Chile"),
45 | ("Fernada", 18, "Ecuador")
46 | ]
47 |
48 | # agregar cada uno de los elementos al QTableWidget
49 | for i, (name, age, city) in enumerate(table_data):
50 | self.table.setItem(i, 0, QTableWidgetItem(name))
51 | self.table.setItem(i, 1, QTableWidgetItem(str(age)))
52 | self.table.setItem(i, 2, QTableWidgetItem(city))
53 |
54 | vbx = QVBoxLayout()
55 | vbx.addWidget(QPushButton('Tutoriales PyQT-5'))
56 | vbx.setAlignment(Qt.AlignTop)
57 | vbx.addWidget(cbx)
58 | vbx.addWidget(self.lv)
59 | vbx.addWidget(self.table)
60 |
61 | self.setWindowTitle("Items View")
62 | self.resize(362, 320)
63 | self.setLayout(vbx)
64 |
65 | def textChanged(self, txt):
66 | QApplication.setStyle(QStyleFactory.create(txt))
67 |
68 | def itemChanged(self):
69 | item = QListWidgetItem(self.lv.currentItem())
70 | print("Sistema seleccionado: ", item.text())
71 |
72 | def tableItemChanged(self):
73 | name, age, city = self.table.selectedItems()
74 | print("Data:", name.text(), age.text(), city.text())
75 |
76 |
77 | if __name__ == '__main__':
78 | app = QApplication(sys.argv)
79 | ejm = Example()
80 | ejm.show()
81 | sys.exit(app.exec_())
82 |
--------------------------------------------------------------------------------
/07-dialogs/dialogs.py:
--------------------------------------------------------------------------------
1 | import sys
2 |
3 | from PyQt5.QtCore import Qt, QDir
4 | from PyQt5.QtGui import QPalette
5 | from PyQt5.QtWidgets import QWidget, QApplication, QInputDialog, QVBoxLayout, QPushButton, QFileDialog, QColorDialog, \
6 | QFontDialog, QMessageBox
7 |
8 |
9 | class Example(QWidget):
10 | def __init__(self, parent=None):
11 | super(Example, self).__init__(parent)
12 |
13 | btn0 = QPushButton('Mostrar QInputDialog')
14 | btn0.clicked.connect(self.showIntDialog)
15 |
16 | btn1 = QPushButton('Mostrar QFileDialog')
17 | btn1.clicked.connect(self.buscarArchivo)
18 |
19 | btn2 = QPushButton('Mostrar QColorDialog')
20 | btn2.clicked.connect(self.buscarColor)
21 |
22 | btn3 = QPushButton('Mostrar QFontDialog')
23 | btn3.clicked.connect(self.cambiarFuente)
24 |
25 | btn4 = QPushButton('Mostrar QMessageBox')
26 | btn4.clicked.connect(self.showDialog)
27 |
28 | vbox = QVBoxLayout()
29 | vbox.addWidget(btn0)
30 | vbox.addWidget(btn1)
31 | vbox.addWidget(btn2)
32 | vbox.addWidget(btn3)
33 | vbox.addWidget(btn4)
34 | vbox.addStretch(0)
35 |
36 | self.setLayout(vbox)
37 | self.setWindowTitle("Cuadros de Dialogo")
38 | self.resize(250, 320)
39 |
40 | def buscarArchivo(self):
41 | file, _ = QFileDialog.getOpenFileName(self, 'Buscar Archivo')#, QDir.homePath(), "All Files (*);;Text Files (*.txt)")
42 | if file:
43 | print("Archivo seleccionado: ", file)
44 |
45 | def showIntDialog(self):
46 | value, ok = QInputDialog.getText(self, "getText()", "Como te llamas:")
47 | if ok and value != '' : print('Nombre:', value)
48 |
49 | value, ok = QInputDialog.getInt(self, "getInt()", "Dime Tu Edad:", 18, 1, 150)
50 | if ok : print('Edad:', value)
51 |
52 | value, ok = QInputDialog.getDouble(self, "getDouble()", "Cuanto Pesas:")
53 | if ok : print('Peso:', value)
54 |
55 | items = ("Perro", "Gato", "Aves", "Serpientes", "Otros")
56 | value, ok = QInputDialog.getItem(self, "getItem()", "Mascota favorita:", items, 2)
57 | if ok : print('Mascota:', value)
58 |
59 | def buscarColor(self):
60 | color = QColorDialog.getColor(Qt.red, self)
61 | if color.isValid():
62 | self.setPalette(QPalette(color))
63 |
64 | def cambiarFuente(self):
65 | font, ok = QFontDialog.getFont(self)
66 | if ok:
67 | self.setFont(font)
68 |
69 | def showDialog(self):
70 | # QMessageBox.warning(self, "Warning Dialog", "Peligro Alto Voltage")
71 | reply = QMessageBox.critical(self, "QMessageBox.critical()",
72 | "Error irrecuperable en la aplicacion \n que desea hacer para proceder.",
73 | QMessageBox.Abort | QMessageBox.Retry | QMessageBox.Ignore)
74 | if reply == QMessageBox.Abort:
75 | print("Abortar la mision")
76 | elif reply == QMessageBox.Retry:
77 | print("Intentar nuevamente")
78 | else:
79 | print("Nada por ahora")
80 |
81 | if __name__ == '__main__':
82 | app = QApplication(sys.argv)
83 | dialog = Example()
84 | dialog.show()
85 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/08-qss/untitled.ui:
--------------------------------------------------------------------------------
1 |
2 |
Este es un archivo HTML
local.
Si deseas acceder página indica su URL
y presiona Ir