├── Calculadora Basica PyQt5
├── Calculadora.py
├── icono.ico
├── icono.png
└── main.py
├── GUI Login
├── design.ui
├── image
│ ├── check-square.svg
│ ├── chevron-down.svg
│ ├── chevron-up.svg
│ ├── facebook.png
│ ├── fondo.jpg
│ ├── google.png
│ ├── lock.svg
│ ├── minus.svg
│ ├── square.svg
│ ├── user.svg
│ └── x.svg
└── main.py
├── Grafica con Matplotlib PyQt5
├── GUI.py
├── main_grafica.py
└── pyqt5-y-matplotlib.png
├── Leer archivos excel con pandas
├── main.py
└── tabla.py
├── Menu Lateral desplegable
├── archivo.png
├── barra-de-menus.png
├── base-de-datos.png
├── cerrar.png
├── chip.png
├── encriptado.png
├── imagen_dos.png
├── inteligencia-artificial.png
├── main.py
├── maximizar.png
├── menu.py
├── menu.ui
├── minimizar.png
├── moto.png
├── restaurar.png
├── screenshot.png
└── videojuego.png
├── ProgressBarCircular con ardino
├── codigo_arduino
│ └── codigo_arduino.ino
├── comunicacion_serial.py
├── diagrama_conexión.png
├── main.py
└── ui_progressBarCircular.py
└── README.md
/Calculadora Basica PyQt5/Calculadora.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Form implementation generated from reading ui file 'calculadora.ui'#
3 | # Created by: PyQt5 UI code generator 5.9.2#
4 | # WARNING! All changes made in this file will be lost!
5 | from PyQt5 import QtCore, QtGui, QtWidgets
6 |
7 | class Ui_Form(object):
8 | def setupUi(self, Form):
9 | Form.setObjectName("Form")
10 | Form.resize(342, 311)
11 | icon = QtGui.QIcon()
12 | icon.addPixmap(QtGui.QPixmap("icono.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
13 | Form.setWindowIcon(icon)
14 | Form.setStyleSheet("background-color: rgb(0, 0, 0);")
15 | self.boton_uno = QtWidgets.QPushButton(Form)
16 | self.boton_uno.setGeometry(QtCore.QRect(12, 52, 75, 35))
17 | self.boton_uno.setStyleSheet("background-color: rgb(0, 170, 255);\n"
18 | "font: 87 14pt \"Arial Black\";")
19 | self.boton_uno.setObjectName("boton_uno")
20 | self.boton_dos = QtWidgets.QPushButton(Form)
21 | self.boton_dos.setGeometry(QtCore.QRect(93, 52, 75, 35))
22 | self.boton_dos.setStyleSheet("background-color: rgb(0, 170, 255);\n"
23 | "font: 87 14pt \"Arial Black\";")
24 | self.boton_dos.setObjectName("boton_dos")
25 | self.boton_tres = QtWidgets.QPushButton(Form)
26 | self.boton_tres.setGeometry(QtCore.QRect(174, 52, 75, 35))
27 | self.boton_tres.setStyleSheet("background-color: rgb(0, 170, 255);\n"
28 | "font: 87 14pt \"Arial Black\";")
29 | self.boton_tres.setObjectName("boton_tres")
30 | self.boton_abrir = QtWidgets.QPushButton(Form)
31 | self.boton_abrir.setGeometry(QtCore.QRect(255, 52, 75, 35))
32 | self.boton_abrir.setStyleSheet("background-color: rgb(0, 170, 127);\n"
33 | "font: 87 14pt \"Arial Black\";")
34 | self.boton_abrir.setObjectName("boton_abrir")
35 | self.valor = QtWidgets.QLabel(Form)
36 | self.valor.setGeometry(QtCore.QRect(10, 10, 321, 31))
37 | self.valor.setStyleSheet("background-color: rgb(170, 255, 255);\n"
38 | "font: 87 14pt \"Arial Black\";")
39 | self.valor.setText("")
40 | self.valor.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
41 | self.valor.setIndent(0)
42 | self.valor.setObjectName("valor")
43 | self.label_2 = QtWidgets.QLabel(Form)
44 | self.label_2.setGeometry(QtCore.QRect(10, 10, 321, 31))
45 | self.label_2.setStyleSheet("background-color: rgb(170, 255, 255);\n"
46 | "font: 87 14pt \"Arial Black\";")
47 | self.label_2.setText("")
48 | self.label_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
49 | self.label_2.setIndent(0)
50 | self.label_2.setObjectName("label_2")
51 | self.boton_cinco = QtWidgets.QPushButton(Form)
52 | self.boton_cinco.setGeometry(QtCore.QRect(93, 95, 75, 35))
53 | self.boton_cinco.setStyleSheet("background-color: rgb(0, 170, 255);\n"
54 | "font: 87 14pt \"Arial Black\";")
55 | self.boton_cinco.setObjectName("boton_cinco")
56 | self.boton_seis = QtWidgets.QPushButton(Form)
57 | self.boton_seis.setGeometry(QtCore.QRect(174, 95, 75, 35))
58 | self.boton_seis.setStyleSheet("background-color: rgb(0, 170, 255);\n"
59 | "font: 87 14pt \"Arial Black\";")
60 | self.boton_seis.setObjectName("boton_seis")
61 | self.boton_cerrar = QtWidgets.QPushButton(Form)
62 | self.boton_cerrar.setGeometry(QtCore.QRect(255, 95, 75, 35))
63 | self.boton_cerrar.setStyleSheet("background-color: rgb(0, 170, 127);\n"
64 | "font: 87 14pt \"Arial Black\";")
65 | self.boton_cerrar.setObjectName("boton_cerrar")
66 | self.boton_cuatro = QtWidgets.QPushButton(Form)
67 | self.boton_cuatro.setGeometry(QtCore.QRect(12, 95, 75, 35))
68 | self.boton_cuatro.setStyleSheet("background-color: rgb(0, 170, 255);\n"
69 | "font: 87 14pt \"Arial Black\";")
70 | self.boton_cuatro.setObjectName("boton_cuatro")
71 | self.boton_mas = QtWidgets.QPushButton(Form)
72 | self.boton_mas.setGeometry(QtCore.QRect(12, 181, 75, 35))
73 | self.boton_mas.setStyleSheet("background-color: rgb(0, 170, 127);\n"
74 | "font: 87 14pt \"Arial Black\";")
75 | self.boton_mas.setObjectName("boton_mas")
76 | self.boton_c = QtWidgets.QPushButton(Form)
77 | self.boton_c.setGeometry(QtCore.QRect(174, 181, 75, 35))
78 | self.boton_c.setStyleSheet("background-color: rgb(255, 85, 0);\n"
79 | "font: 87 14pt \"Arial Black\";")
80 | self.boton_c.setObjectName("boton_c")
81 | self.boton_cero = QtWidgets.QPushButton(Form)
82 | self.boton_cero.setGeometry(QtCore.QRect(93, 181, 75, 35))
83 | self.boton_cero.setStyleSheet("background-color: rgb(0, 170, 255);\n"
84 | "font: 87 14pt \"Arial Black\";")
85 | self.boton_cero.setObjectName("boton_cero")
86 | self.boton_menos = QtWidgets.QPushButton(Form)
87 | self.boton_menos.setGeometry(QtCore.QRect(12, 267, 75, 35))
88 | self.boton_menos.setStyleSheet("background-color: rgb(0, 170, 127);\n"
89 | "font: 87 14pt \"Arial Black\";")
90 | self.boton_menos.setObjectName("boton_menos")
91 | self.boton_100 = QtWidgets.QPushButton(Form)
92 | self.boton_100.setGeometry(QtCore.QRect(93, 267, 75, 35))
93 | self.boton_100.setStyleSheet("background-color: rgb(0, 170, 127);\n"
94 | "font: 87 14pt \"Arial Black\";")
95 | self.boton_100.setObjectName("boton_100")
96 | self.boton_salir = QtWidgets.QPushButton(Form)
97 | self.boton_salir.setGeometry(QtCore.QRect(174, 267, 155, 35))
98 | self.boton_salir.setStyleSheet("background-color: rgb(255, 0, 0);\n"
99 | "font: 87 14pt \"Arial Black\";")
100 | self.boton_salir.setObjectName("boton_salir")
101 | self.boton_ac = QtWidgets.QPushButton(Form)
102 | self.boton_ac.setGeometry(QtCore.QRect(174, 224, 75, 35))
103 | self.boton_ac.setStyleSheet("background-color: rgb(255, 85, 0);\n"
104 | "font: 87 14pt \"Arial Black\";")
105 | self.boton_ac.setObjectName("boton_ac")
106 | self.boton_por = QtWidgets.QPushButton(Form)
107 | self.boton_por.setGeometry(QtCore.QRect(12, 224, 75, 35))
108 | self.boton_por.setStyleSheet("background-color: rgb(0, 170, 127);\n"
109 | "font: 87 14pt \"Arial Black\";")
110 | self.boton_por.setObjectName("boton_por")
111 | self.boton_entre = QtWidgets.QPushButton(Form)
112 | self.boton_entre.setGeometry(QtCore.QRect(93, 224, 75, 35))
113 | self.boton_entre.setStyleSheet("background-color: rgb(0, 170, 127);\n"
114 | "font: 87 14pt \"Arial Black\";")
115 | self.boton_entre.setObjectName("boton_entre")
116 | self.boton_igual = QtWidgets.QPushButton(Form)
117 | self.boton_igual.setGeometry(QtCore.QRect(255, 181, 75, 76))
118 | self.boton_igual.setStyleSheet("background-color: rgb(0, 170, 0);\n"
119 | "font: 87 14pt \"Arial Black\";")
120 | self.boton_igual.setObjectName("boton_igual")
121 | self.boton_ocho = QtWidgets.QPushButton(Form)
122 | self.boton_ocho.setGeometry(QtCore.QRect(93, 138, 75, 35))
123 | self.boton_ocho.setStyleSheet("background-color: rgb(0, 170, 255);\n"
124 | "font: 87 14pt \"Arial Black\";")
125 | self.boton_ocho.setObjectName("boton_ocho")
126 | self.boton_siete = QtWidgets.QPushButton(Form)
127 | self.boton_siete.setGeometry(QtCore.QRect(12, 138, 75, 35))
128 | self.boton_siete.setStyleSheet("background-color: rgb(0, 170, 255);\n"
129 | "font: 87 14pt \"Arial Black\";")
130 | self.boton_siete.setObjectName("boton_siete")
131 | self.boton_nueve = QtWidgets.QPushButton(Form)
132 | self.boton_nueve.setGeometry(QtCore.QRect(174, 138, 75, 35))
133 | self.boton_nueve.setStyleSheet("background-color: rgb(0, 170, 255);\n"
134 | "font: 87 14pt \"Arial Black\";")
135 | self.boton_nueve.setObjectName("boton_nueve")
136 | self.boton_punto = QtWidgets.QPushButton(Form)
137 | self.boton_punto.setGeometry(QtCore.QRect(255, 138, 75, 35))
138 | self.boton_punto.setStyleSheet("background-color: rgb(0, 170, 127);\n"
139 | "font: 87 14pt \"Arial Black\";")
140 | self.boton_punto.setObjectName("boton_punto")
141 | self.label_2.raise_()
142 | self.boton_uno.raise_()
143 | self.boton_dos.raise_()
144 | self.boton_tres.raise_()
145 | self.boton_abrir.raise_()
146 | self.valor.raise_()
147 |
148 | self.retranslateUi(Form)
149 | self.boton_salir.clicked.connect(Form.close)
150 | self.boton_c.clicked.connect(self.valor.clear)
151 | QtCore.QMetaObject.connectSlotsByName(Form)
152 |
153 | def retranslateUi(self, Form):
154 | _translate = QtCore.QCoreApplication.translate
155 | Form.setWindowTitle(_translate("Form", "Calculadora"))
156 | self.boton_uno.setText(_translate("Form", "1"))
157 | self.boton_uno.setShortcut(_translate("Form", "1"))
158 | self.boton_dos.setText(_translate("Form", "2"))
159 | self.boton_dos.setShortcut(_translate("Form", "2"))
160 | self.boton_tres.setText(_translate("Form", "3"))
161 | self.boton_tres.setShortcut(_translate("Form", "3"))
162 | self.boton_abrir.setText(_translate("Form", "("))
163 | self.boton_abrir.setShortcut(_translate("Form", "Ctrl+8"))
164 | self.boton_cinco.setText(_translate("Form", "5"))
165 | self.boton_cinco.setShortcut(_translate("Form", "5"))
166 | self.boton_seis.setText(_translate("Form", "6"))
167 | self.boton_seis.setShortcut(_translate("Form", "6"))
168 | self.boton_cerrar.setText(_translate("Form", ")"))
169 | self.boton_cerrar.setShortcut(_translate("Form", "Ctrl+9"))
170 | self.boton_cuatro.setText(_translate("Form", "4"))
171 | self.boton_mas.setText(_translate("Form", "+"))
172 | self.boton_mas.setShortcut(_translate("Form", "+"))
173 | self.boton_c.setText(_translate("Form", "C"))
174 | self.boton_c.setShortcut(_translate("Form", "Esc"))
175 | self.boton_cero.setText(_translate("Form", "0"))
176 | self.boton_menos.setText(_translate("Form", "-"))
177 | self.boton_menos.setShortcut(_translate("Form", "-"))
178 | self.boton_100.setText(_translate("Form", "%"))
179 | self.boton_salir.setText(_translate("Form", "SALIR"))
180 | self.boton_ac.setText(_translate("Form", "AC"))
181 | self.boton_ac.setShortcut(_translate("Form", "Backspace"))
182 | self.boton_por.setText(_translate("Form", "x"))
183 | self.boton_por.setShortcut(_translate("Form", "Ctrl++"))
184 | self.boton_entre.setText(_translate("Form", "÷"))
185 | self.boton_entre.setShortcut(_translate("Form", "Ctrl+7"))
186 | self.boton_igual.setText(_translate("Form", "="))
187 | self.boton_igual.setShortcut(_translate("Form", "Space"))
188 | self.boton_ocho.setText(_translate("Form", "8"))
189 | self.boton_ocho.setShortcut(_translate("Form", "8"))
190 | self.boton_siete.setText(_translate("Form", "7"))
191 | self.boton_siete.setShortcut(_translate("Form", "7"))
192 | self.boton_nueve.setText(_translate("Form", "9"))
193 | self.boton_nueve.setShortcut(_translate("Form", "9"))
194 | self.boton_punto.setText(_translate("Form", "."))
195 |
196 |
197 | if __name__ == "__main__":
198 | import sys
199 | app = QtWidgets.QApplication(sys.argv)
200 | Form = QtWidgets.QWidget()
201 | ui = Ui_Form()
202 | ui.setupUi(Form)
203 | Form.show()
204 | sys.exit(app.exec_())
205 |
206 |
--------------------------------------------------------------------------------
/Calculadora Basica PyQt5/icono.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Calculadora Basica PyQt5/icono.ico
--------------------------------------------------------------------------------
/Calculadora Basica PyQt5/icono.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Calculadora Basica PyQt5/icono.png
--------------------------------------------------------------------------------
/Calculadora Basica PyQt5/main.py:
--------------------------------------------------------------------------------
1 | # Calculadora Basica en Python con PyQt5
2 | # @autor: Magno Efren
3 | # Youtube: https://www.youtube.com/c/MagnoEfren
4 | import sys
5 | from Calculadora import *
6 |
7 | class MiFormulario(QtWidgets.QWidget):
8 | def __init__(self, parent=None):
9 | QtWidgets.QWidget.__init__(self, parent)
10 | self.ui = Ui_Form()
11 | self.ui.setupUi(self)
12 | self.ui.boton_cero.clicked.connect(self.obtener)
13 | self.ui.boton_uno.clicked.connect(self.obtener1)
14 | self.ui.boton_dos.clicked.connect(self.obtener2)
15 | self.ui.boton_tres.clicked.connect(self.obtener3)
16 | self.ui.boton_cuatro.clicked.connect(self.obtener4)
17 | self.ui.boton_cinco.clicked.connect(self.obtener5)
18 | self.ui.boton_seis.clicked.connect(self.obtener6)
19 | self.ui.boton_siete.clicked.connect(self.obtener7)
20 | self.ui.boton_ocho.clicked.connect(self.obtener8)
21 | self.ui.boton_nueve.clicked.connect(self.obtener9)
22 | self.ui.boton_menos.clicked.connect(self.obtener10)
23 | self.ui.boton_mas.clicked.connect(self.obtener11)
24 | self.ui.boton_por.clicked.connect(self.obtener12)
25 | self.ui.boton_entre.clicked.connect(self.obtener13)
26 | self.ui.boton_100.clicked.connect(self.obtener14)
27 | self.ui.boton_igual.clicked.connect(self.obtener15)
28 | self.ui.boton_abrir.clicked.connect(self.obtener16)
29 | self.ui.boton_cerrar.clicked.connect(self.obtener17)
30 | self.ui.boton_punto.clicked.connect(self.obtener18)
31 | self.ui.boton_ac.clicked.connect(self.obtener19)
32 |
33 | def obtener(self):
34 | entrada= self.ui.valor.text()
35 | entrada += "0"
36 | self.ui.valor.setText(entrada)
37 | def obtener1(self):
38 | entrada= self.ui.valor.text()
39 | entrada += "1"
40 | self.ui.valor.setText(entrada)
41 | def obtener2(self):
42 | entrada= self.ui.valor.text()
43 | entrada += "2"
44 | self.ui.valor.setText(entrada)
45 | def obtener3(self):
46 | entrada= self.ui.valor.text()
47 | entrada += "3"
48 | self.ui.valor.setText(entrada)
49 | def obtener4(self):
50 | entrada= self.ui.valor.text()
51 | entrada += "4"
52 | self.ui.valor.setText(entrada)
53 | def obtener5(self):
54 | entrada= self.ui.valor.text()
55 | entrada += "5"
56 | self.ui.valor.setText(entrada)
57 | def obtener6(self):
58 | entrada= self.ui.valor.text()
59 | entrada += "6"
60 | self.ui.valor.setText(entrada)
61 | def obtener7(self):
62 | entrada= self.ui.valor.text()
63 | entrada += "7"
64 | self.ui.valor.setText(entrada)
65 | def obtener8(self):
66 | entrada= self.ui.valor.text()
67 | entrada += "8"
68 | self.ui.valor.setText(entrada)
69 | def obtener9(self):
70 | entrada= self.ui.valor.text()
71 | entrada += "9"
72 | self.ui.valor.setText(entrada)
73 | def obtener10(self):
74 | entrada= self.ui.valor.text()
75 | entrada += "-"
76 | self.ui.valor.setText(entrada)
77 | def obtener11(self):
78 | entrada= self.ui.valor.text()
79 | entrada += "+"
80 | self.ui.valor.setText(entrada)
81 | def obtener12(self):
82 | entrada= self.ui.valor.text()
83 | entrada += "*"
84 | self.ui.valor.setText(entrada)
85 | def obtener13(self):
86 | entrada= self.ui.valor.text()
87 | entrada += "/"
88 | self.ui.valor.setText(entrada)
89 | def obtener14(self):
90 | entrada= self.ui.valor.text()
91 | try:
92 | self.an = (entrada+"/100")
93 | self.ui.valor.setText(self.an)
94 | except:
95 | self.ui.valor.setText("")
96 |
97 | def obtener15(self):
98 | entrada= self.ui.valor.text()
99 | try:
100 | ans= eval(entrada)
101 | self.ui.valor.setText(str(ans))
102 | except:
103 | self.ui.valor.setText("ERROR")
104 | def obtener16(self):
105 | entrada = self.ui.valor.text()
106 | entrada += "("
107 | self.ui.valor.setText(entrada)
108 | def obtener17(self):
109 | entrada = self.ui.valor.text()
110 | entrada += ")"
111 | self.ui.valor.setText(entrada)
112 |
113 | def obtener18(self):
114 | entrada = self.ui.valor.text()
115 | entrada += "."
116 | self.ui.valor.setText(entrada)
117 |
118 | def obtener19(self):
119 | entrada = self.ui.valor.text()
120 | self.ui.valor.setText(entrada[:len(entrada)-1])
121 | if __name__ == "__main__":
122 | app = QtWidgets.QApplication(sys.argv)
123 | mi_app = MiFormulario()
124 | mi_app.show()
125 | sys.exit(app.exec_())
126 |
--------------------------------------------------------------------------------
/GUI Login/design.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 559
10 | 552
11 |
12 |
13 |
14 | MainWindow
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | 0
26 |
27 |
28 | 0
29 |
30 |
31 | 0
32 |
33 |
34 | 0
35 |
36 |
37 | 0
38 |
39 | -
40 |
41 |
42 | true
43 |
44 |
45 |
46 | QFrame {
47 |
48 | border-radius:10px;
49 | background-image: url(image/fondo.jpg);
50 | }
51 |
52 |
53 |
54 | QFrame::StyledPanel
55 |
56 |
57 | QFrame::Raised
58 |
59 |
60 |
-
61 |
62 |
63 |
64 | 0
65 | 40
66 |
67 |
68 |
69 |
70 | 16777215
71 | 40
72 |
73 |
74 |
75 | QPushButton{
76 | border-radius:18px;
77 | }
78 |
79 | QPushButton:hover{
80 | background-color: rgb(0, 0, 0);
81 | }
82 |
83 |
84 |
85 | QFrame::StyledPanel
86 |
87 |
88 | QFrame::Raised
89 |
90 |
91 |
92 | 4
93 |
94 |
95 | 0
96 |
97 |
98 | 0
99 |
100 |
101 | 0
102 |
103 |
104 | 0
105 |
106 |
-
107 |
108 |
109 | Qt::Horizontal
110 |
111 |
112 |
113 | 443
114 | 20
115 |
116 |
117 |
118 |
119 | -
120 |
121 |
122 |
123 | 38
124 | 38
125 |
126 |
127 |
128 |
129 | 38
130 | 38
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | image/minus.svgimage/minus.svg
139 |
140 |
141 |
142 | 38
143 | 38
144 |
145 |
146 |
147 |
148 | -
149 |
150 |
151 |
152 | 38
153 | 38
154 |
155 |
156 |
157 |
158 | 38
159 | 38
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 | image/chevron-up.svgimage/chevron-up.svg
168 |
169 |
170 |
171 | 38
172 | 38
173 |
174 |
175 |
176 |
177 | -
178 |
179 |
180 |
181 | 38
182 | 38
183 |
184 |
185 |
186 |
187 | 38
188 | 38
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 | image/chevron-down.svgimage/chevron-down.svg
197 |
198 |
199 |
200 | 38
201 | 38
202 |
203 |
204 |
205 |
206 | -
207 |
208 |
209 |
210 | 38
211 | 38
212 |
213 |
214 |
215 |
216 | 38
217 | 38
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 | image/x.svgimage/x.svg
226 |
227 |
228 |
229 | 38
230 | 38
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 | -
239 |
240 |
241 | QFrame::StyledPanel
242 |
243 |
244 | QFrame::Raised
245 |
246 |
247 |
-
248 |
249 |
250 | Qt::Horizontal
251 |
252 |
253 |
254 | 178
255 | 20
256 |
257 |
258 |
259 |
260 | -
261 |
262 |
-
263 |
264 |
265 | Qt::Vertical
266 |
267 |
268 |
269 | 28
270 | 28
271 |
272 |
273 |
274 |
275 | -
276 |
277 |
278 |
279 | 400
280 | 600
281 |
282 |
283 |
284 | QLabel {
285 | color: rgb(255, 255, 254);
286 | font: 12pt "Arial";
287 | background-color: rgba(0, 0, 0,0);
288 | }
289 |
290 |
291 | QLineEdit{
292 | background-color: rgba(0, 0, 0,0);
293 | border-radius:10px;
294 | font: 12pt "Arial";
295 | color: rgb(255, 255, 254);
296 | border: 2px solid rgb(255, 255, 255);
297 |
298 | }
299 |
300 | QLineEdit:hover{
301 | background-color: rgba(0, 0, 0,0);
302 | border-radius:10px;
303 | font: 12pt "Arial";
304 | border: 2px solid rgb(120, 0, 171);
305 | }
306 |
307 | QLineEdit:focus{
308 | background-color: rgb(0, 0, 0);
309 | border-radius:10px;
310 | font: 12pt "Arial";
311 | border: 2px solid rgb(120, 0, 171);
312 | }
313 |
314 | QCheckBox{
315 | font: 12pt "Arial";
316 | color: rgb(255, 255, 255);
317 | }
318 |
319 | QCheckBox::indicator {
320 | width: 18px;
321 | height:18px;
322 | }
323 |
324 | QCheckBox::indicator:unchecked {
325 | background-image: url(image/square.svg);
326 | }
327 |
328 | QCheckBox::indicator:checked {
329 | background-image: url(image/check-square.svg);
330 | }
331 |
332 | QPushButton{
333 | border-radius:10px;
334 | font: 12pt "Arial";
335 | color: rgb(255, 255, 254);
336 | border: 2px solid #ffffff;
337 | }
338 |
339 | QPushButton:hover{
340 | border-radius:10px;
341 | font: 12pt "Arial";
342 | color: rgb(255, 255, 255);
343 | border: 2px solid rgb(120, 0, 171);
344 | background-color: rgb(120, 0, 171);
345 | }
346 |
347 |
348 |
349 | QFrame::StyledPanel
350 |
351 |
352 | QFrame::Raised
353 |
354 |
355 |
-
356 |
357 |
358 |
359 | 16777215
360 | 50
361 |
362 |
363 |
364 | font: 16pt "Arial";
365 |
366 |
367 | Iniciar Aplicación
368 |
369 |
370 | Qt::AlignCenter
371 |
372 |
373 |
374 | -
375 |
376 |
377 | Qt::Vertical
378 |
379 |
380 |
381 | 20
382 | 40
383 |
384 |
385 |
386 |
387 | -
388 |
389 |
390 |
391 | 0
392 | 35
393 |
394 |
395 |
396 |
397 | -
398 |
399 |
400 | Qt::Vertical
401 |
402 |
403 |
404 | 20
405 | 40
406 |
407 |
408 |
409 |
410 | -
411 |
412 |
413 |
414 | 0
415 | 35
416 |
417 |
418 |
419 |
420 | 16777215
421 | 16777215
422 |
423 |
424 |
425 | QLineEdit::Password
426 |
427 |
428 |
429 | -
430 |
431 |
432 | Qt::Vertical
433 |
434 |
435 |
436 | 20
437 | 40
438 |
439 |
440 |
441 |
442 | -
443 |
444 |
445 | Recordar contraseña
446 |
447 |
448 |
449 | -
450 |
451 |
452 | Qt::Vertical
453 |
454 |
455 |
456 | 20
457 | 40
458 |
459 |
460 |
461 |
462 | -
463 |
464 |
465 |
466 | 0
467 | 35
468 |
469 |
470 |
471 | Iniciar Sesión
472 |
473 |
474 |
475 | -
476 |
477 |
478 | Qt::Vertical
479 |
480 |
481 |
482 | 20
483 | 40
484 |
485 |
486 |
487 |
488 | -
489 |
490 |
-
491 |
492 |
493 | Facebook
494 |
495 |
496 |
497 | image/facebook.pngimage/facebook.png
498 |
499 |
500 |
501 | 35
502 | 35
503 |
504 |
505 |
506 |
507 | -
508 |
509 |
510 | Google
511 |
512 |
513 |
514 | image/google.pngimage/google.png
515 |
516 |
517 |
518 | 35
519 | 35
520 |
521 |
522 |
523 |
524 |
525 |
526 | -
527 |
528 |
529 | Qt::Vertical
530 |
531 |
532 |
533 | 20
534 | 40
535 |
536 |
537 |
538 |
539 | -
540 |
541 |
-
542 |
543 |
544 | ¿No tienes una cuenta?
545 |
546 |
547 |
548 | -
549 |
550 |
551 | QPushButton{
552 | border-radius:10px;
553 | font: 12pt "Arial";
554 | color: rgb(255, 255, 254);
555 | border: None;
556 | background-color: None;
557 | }
558 |
559 | QPushButton:hover{
560 | border-radius:10px;
561 | font: 12pt "Arial";
562 | color: rgb(117, 0, 175);
563 | border: None;
564 | background-color: None;
565 | }
566 |
567 |
568 |
569 | Inscribete
570 |
571 |
572 |
573 | -
574 |
575 |
576 | Qt::Horizontal
577 |
578 |
579 |
580 | 40
581 | 20
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 | -
592 |
593 |
594 | Qt::Vertical
595 |
596 |
597 |
598 | 20
599 | 40
600 |
601 |
602 |
603 |
604 |
605 |
606 | -
607 |
608 |
609 | Qt::Horizontal
610 |
611 |
612 |
613 | 177
614 | 20
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
--------------------------------------------------------------------------------
/GUI Login/image/check-square.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GUI Login/image/chevron-down.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GUI Login/image/chevron-up.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GUI Login/image/facebook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/GUI Login/image/facebook.png
--------------------------------------------------------------------------------
/GUI Login/image/fondo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/GUI Login/image/fondo.jpg
--------------------------------------------------------------------------------
/GUI Login/image/google.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/GUI Login/image/google.png
--------------------------------------------------------------------------------
/GUI Login/image/lock.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GUI Login/image/minus.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GUI Login/image/square.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GUI Login/image/user.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GUI Login/image/x.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GUI Login/main.py:
--------------------------------------------------------------------------------
1 | # Youtube: Magno Efren
2 | # https://www.youtube.com/c/MagnoEfren
3 |
4 | from PyQt5.QtWidgets import QMainWindow, QApplication,QLineEdit
5 | from PyQt5.QtGui import QGuiApplication,QIcon
6 | from PyQt5 import QtCore, QtWidgets
7 | from PyQt5.uic import loadUi
8 | from PyQt5.QtCore import Qt
9 | import sys
10 |
11 | class Login(QMainWindow):
12 | def __init__(self):
13 | super(Login, self).__init__()
14 | loadUi('design.ui', self)
15 | self.bt_normal.hide()
16 | self.click_posicion = None
17 | self.bt_minimize.clicked.connect(lambda :self.showMinimized())
18 | self.bt_normal.clicked.connect(self.control_bt_normal)
19 | self.bt_maximize.clicked.connect(self.control_bt_maximize)
20 | self.bt_close.clicked.connect(lambda: self.close())
21 |
22 | # Eliminar barra de titulo y opacidad
23 | self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
24 | self.setWindowOpacity(1)
25 | self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
26 | self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
27 |
28 | # SizeGrip
29 | self.gripSize = 10
30 | self.grip = QtWidgets.QSizeGrip(self)
31 | self.grip.resize(self.gripSize, self.gripSize)
32 | # mover ventana
33 | self.frame_superior.mouseMoveEvent = self.mover_ventana
34 |
35 |
36 | icon_user = QIcon("image/user.svg")
37 | icon_lock = QIcon("image/lock.svg")
38 | self.lineEdit1.addAction(icon_user, QLineEdit.LeadingPosition) #QLineEdit.TrailingPosition
39 | self.lineEdit2.addAction(icon_lock, QLineEdit.LeadingPosition)
40 |
41 |
42 | def control_bt_normal(self):
43 | self.showNormal()
44 | self.bt_normal.hide()
45 | self.bt_maximize.show()
46 |
47 | def control_bt_maximize(self):
48 | self.showMaximized()
49 | self.bt_maximize.hide()
50 | self.bt_normal.show()
51 |
52 | ## SizeGrip
53 | def resizeEvent(self, event):
54 | rect = self.rect()
55 | self.grip.move(rect.right() - self.gripSize, rect.bottom() - self.gripSize)
56 |
57 | ## mover ventana
58 | def mousePressEvent(self, event):
59 | self.click_posicion = event.globalPos()
60 |
61 | def mover_ventana(self, event):
62 | if self.isMaximized() == False:
63 | if event.buttons() == QtCore.Qt.LeftButton:
64 | self.move(self.pos() + event.globalPos() - self.click_posicion)
65 | self.click_posicion = event.globalPos()
66 | event.accept()
67 | if event.globalPos().y() <=5 or event.globalPos().x() <=5 :
68 | self.showMaximized()
69 | self.bt_maximize.hide()
70 | self.bt_normal.show()
71 | else:
72 | self.showNormal()
73 | self.bt_normal.hide()
74 | self.bt_maximize.show()
75 |
76 | if __name__ == '__main__':
77 | app = QApplication(sys.argv)
78 | my_app = Login()
79 | my_app.show()
80 | sys.exit(app.exec_())
81 |
--------------------------------------------------------------------------------
/Grafica con Matplotlib PyQt5/GUI.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'GUI.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.12.3
6 | #
7 | # WARNING! All changes made in this file will be lost!
8 |
9 |
10 | from PyQt5 import QtCore, QtGui, QtWidgets
11 |
12 |
13 | class Ui_MainWindow(object):
14 | def setupUi(self, MainWindow):
15 | MainWindow.setObjectName("MainWindow")
16 | MainWindow.resize(627, 345)
17 | self.centralwidget = QtWidgets.QWidget(MainWindow)
18 | self.centralwidget.setMinimumSize(QtCore.QSize(400, 200))
19 | self.centralwidget.setObjectName("centralwidget")
20 | self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
21 | self.verticalLayout.setContentsMargins(0, 0, 0, 0)
22 | self.verticalLayout.setSpacing(0)
23 | self.verticalLayout.setObjectName("verticalLayout")
24 | self.frame = QtWidgets.QFrame(self.centralwidget)
25 | self.frame.setStyleSheet("background-color: rgb(0, 0, 0);")
26 | self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
27 | self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
28 | self.frame.setObjectName("frame")
29 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame)
30 | self.horizontalLayout.setContentsMargins(2, 2, 2, 2)
31 | self.horizontalLayout.setSpacing(0)
32 | self.horizontalLayout.setObjectName("horizontalLayout")
33 | self.verticalLayout_grafica = QtWidgets.QVBoxLayout()
34 | self.verticalLayout_grafica.setObjectName("verticalLayout_grafica")
35 | self.horizontalLayout.addLayout(self.verticalLayout_grafica)
36 | self.frame_control = QtWidgets.QFrame(self.frame)
37 | self.frame_control.setMinimumSize(QtCore.QSize(0, 0))
38 | self.frame_control.setStyleSheet("background-color: rgb(0, 170, 127);")
39 | self.frame_control.setFrameShape(QtWidgets.QFrame.StyledPanel)
40 | self.frame_control.setFrameShadow(QtWidgets.QFrame.Raised)
41 | self.frame_control.setObjectName("frame_control")
42 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame_control)
43 | self.verticalLayout_2.setObjectName("verticalLayout_2")
44 | self.label = QtWidgets.QLabel(self.frame_control)
45 | self.label.setStyleSheet("color: rgb(255, 255, 255);\n"
46 | "font: 87 10pt \"Arial Black\";")
47 | self.label.setAlignment(QtCore.Qt.AlignCenter)
48 | self.label.setObjectName("label")
49 | self.verticalLayout_2.addWidget(self.label)
50 | self.slider1 = QtWidgets.QSlider(self.frame_control)
51 | self.slider1.setMinimumSize(QtCore.QSize(0, 30))
52 | self.slider1.setStyleSheet("QSlider::groove:horizontal {\n"
53 | " border: 1px solid #00ff00;\n"
54 | " height: 4px; \n"
55 | " background: #00ff00;\n"
56 | " \n"
57 | "}\n"
58 | "\n"
59 | "QSlider::handle:horizontal {\n"
60 | " background: rgb(215, 0, 255);\n"
61 | " \n"
62 | " width: 28px;\n"
63 | " height:28px;\n"
64 | "\n"
65 | "left: 11px;\n"
66 | "right: 11px;\n"
67 | "\n"
68 | "\n"
69 | " margin: -12px; \n"
70 | " border-radius:14px;\n"
71 | "}\n"
72 | "\n"
73 | "\n"
74 | "QSlider::add-page:horizontal{\n"
75 | "background-color:white;\n"
76 | "border: 1px solid white;\n"
77 | "}\n"
78 | "")
79 | self.slider1.setMaximum(100)
80 | self.slider1.setSingleStep(1)
81 | self.slider1.setOrientation(QtCore.Qt.Horizontal)
82 | self.slider1.setObjectName("slider1")
83 | self.verticalLayout_2.addWidget(self.slider1)
84 | spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
85 | self.verticalLayout_2.addItem(spacerItem)
86 | self.slider2 = QtWidgets.QSlider(self.frame_control)
87 | self.slider2.setMinimumSize(QtCore.QSize(0, 30))
88 | self.slider2.setStyleSheet("QSlider::groove:horizontal {\n"
89 | " border: 1px solid #00ff00;\n"
90 | " height: 4px; \n"
91 | " background: #00ff00;\n"
92 | " \n"
93 | "}\n"
94 | "\n"
95 | "QSlider::handle:horizontal {\n"
96 | " background: rgb(245, 10, 15);\n"
97 | " \n"
98 | "\n"
99 | " width: 28px;\n"
100 | " height:28px;\n"
101 | "\n"
102 | "left: 11px;\n"
103 | "right: 11px;\n"
104 | "\n"
105 | "\n"
106 | " margin: -12px; \n"
107 | " border-radius:14px;\n"
108 | "}\n"
109 | "\n"
110 | "\n"
111 | "QSlider::add-page:horizontal{\n"
112 | "background-color:white;\n"
113 | "border: 1px solid white;\n"
114 | "}\n"
115 | "")
116 | self.slider2.setMaximum(100)
117 | self.slider2.setSingleStep(1)
118 | self.slider2.setOrientation(QtCore.Qt.Horizontal)
119 | self.slider2.setObjectName("slider2")
120 | self.verticalLayout_2.addWidget(self.slider2)
121 | spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
122 | self.verticalLayout_2.addItem(spacerItem1)
123 | self.pushButton = QtWidgets.QPushButton(self.frame_control)
124 | self.pushButton.setStyleSheet("background-color: rgb(255, 85, 0);")
125 | self.pushButton.setObjectName("pushButton")
126 | self.verticalLayout_2.addWidget(self.pushButton)
127 | self.horizontalLayout.addWidget(self.frame_control)
128 | self.horizontalLayout.setStretch(0, 3)
129 | self.horizontalLayout.setStretch(1, 2)
130 | self.verticalLayout.addWidget(self.frame)
131 | MainWindow.setCentralWidget(self.centralwidget)
132 |
133 | self.retranslateUi(MainWindow)
134 | self.pushButton.clicked.connect(MainWindow.close)
135 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
136 |
137 | def retranslateUi(self, MainWindow):
138 | _translate = QtCore.QCoreApplication.translate
139 | MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
140 | self.label.setText(_translate("MainWindow", "VARIAR AMPLITUD Y FRECUENCIA"))
141 | self.pushButton.setText(_translate("MainWindow", "SALIR"))
142 |
143 |
144 | if __name__ == "__main__":
145 | import sys
146 | app = QtWidgets.QApplication(sys.argv)
147 | MainWindow = QtWidgets.QMainWindow()
148 | ui = Ui_MainWindow()
149 | ui.setupUi(MainWindow)
150 | MainWindow.show()
151 | sys.exit(app.exec_())
152 |
--------------------------------------------------------------------------------
/Grafica con Matplotlib PyQt5/main_grafica.py:
--------------------------------------------------------------------------------
1 | # PyQt5 con Matplotlib
2 | # @autor: Magno Efren
3 | # Youtube: https://www.youtube.com/c/MagnoEfren
4 |
5 | import sys
6 | import numpy as np
7 | from GUI import*
8 | from PyQt5 import QtCore
9 | from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
10 | import matplotlib.pyplot as plt
11 |
12 | class MiApp(QtWidgets.QMainWindow):
13 | def __init__(self):
14 | super().__init__()
15 | self.ui = Ui_MainWindow()
16 | self.ui.setupUi(self)
17 | self.grafica = Canvas_grafica()
18 | self.ui.verticalLayout_grafica.addWidget(self.grafica)
19 | self.ui.slider1.valueChanged.connect(self.slider_uno)
20 | self.ui.slider2.valueChanged.connect(self.slider_dos)
21 |
22 | def slider_uno(self, event):
23 | self.grafica.datos1(event)
24 |
25 | def slider_dos(self, event):
26 | self.grafica.datos2(event)
27 |
28 | class Canvas_grafica(FigureCanvas):
29 | def __init__(self, parent=None):
30 | self.fig , self.ax = plt.subplots(facecolor='gray')
31 | super().__init__(self.fig)
32 | self.ax.grid()
33 | self.ax.margins(x=0)
34 | self.nivel1 = 10
35 | self.nivel2 = 1
36 | self.grafica_datos()
37 |
38 | def datos1(self, valor1):
39 | self.nivel1 = valor1*0.1
40 |
41 | def datos2(self, valor2):
42 | self.nivel2 = valor2*0.05
43 |
44 | def grafica_datos(self):
45 | plt.title("Grafica en PyQt5 con Matplotlib")
46 | x = np.arange(-np.pi, 10*np.pi, 0.01)
47 | line, = self.ax.plot(x, self.nivel1*np.sin(self.nivel2*x), color='r',linewidth=2)
48 | self.draw()
49 | line.set_ydata(np.sin(x)+24)
50 | QtCore.QTimer.singleShot(10, self.grafica_datos)
51 |
52 |
53 | if __name__ == "__main__":
54 | app = QtWidgets.QApplication(sys.argv)
55 | mi_app = MiApp()
56 | mi_app.show()
57 | sys.exit(app.exec_())
58 |
59 |
--------------------------------------------------------------------------------
/Grafica con Matplotlib PyQt5/pyqt5-y-matplotlib.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Grafica con Matplotlib PyQt5/pyqt5-y-matplotlib.png
--------------------------------------------------------------------------------
/Leer archivos excel con pandas/main.py:
--------------------------------------------------------------------------------
1 | # Leer archivos excel desde una GUI en PyQt5
2 | # @autor: Magno Efren
3 | # Youtube: https://www.youtube.com/c/MagnoEfren
4 | import sys
5 | from tabla import*
6 | from PyQt5.QtWidgets import QTableWidgetItem, QFileDialog, QMessageBox
7 | import pandas as pd
8 |
9 | class MiApp(QtWidgets.QMainWindow):
10 | def __init__(self):
11 | super().__init__()
12 | self.ui = Ui_MainWindow()
13 | self.ui.setupUi(self)
14 | self.ui.bt_abrir.clicked.connect(self.abrir_archivo)
15 | self.ui.pushButton.clicked.connect(self.crear_tabla)
16 |
17 | def abrir_archivo(self):
18 | file = QFileDialog.getOpenFileName(self,"Abrir Archivo Excel", "","Excel Files (*.xlsx) ;; All Files (*)")
19 | self.direccion = file[0]
20 | def crear_tabla(self):
21 | try:
22 | df = pd.read_excel(self.direccion)
23 | columnas = list(df.columns)
24 | df_fila = df.to_numpy().tolist()
25 | x = len(columnas)
26 | y = len(df_fila)
27 | except ValueError:
28 | QMessageBox.about (self,'Informacion', 'Formato incorrecto')
29 | return None
30 | except FileNotFoundError:
31 | QMessageBox.about (self,'Informacion', 'El archivo esta \n malogrado')
32 | return None
33 | #print(x, y)
34 | self.ui.tableWidget.setRowCount(y)
35 | self.ui.tableWidget.setColumnCount(x)
36 |
37 | for j in range(x):
38 | #print(columnas[j])
39 | encabezado = QtWidgets.QTableWidgetItem(columnas[j])
40 | self.ui.tableWidget.setHorizontalHeaderItem(j,encabezado )
41 | for i in range(y):
42 | dato = str(df_fila[i][j])
43 | if dato == 'nan':
44 | dato =''
45 | self.ui.tableWidget.setItem(i,j, QTableWidgetItem(dato))
46 | #print(df_fila)
47 | if __name__ == "__main__":
48 | app = QtWidgets.QApplication(sys.argv)
49 | mi_app = MiApp()
50 | mi_app.show()
51 | sys.exit(app.exec_())
52 |
--------------------------------------------------------------------------------
/Leer archivos excel con pandas/tabla.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'tabla.ui'
4 | # Created by: PyQt5 UI code generator 5.12.3
5 | # WARNING! All changes made in this file will be lost!
6 |
7 | from PyQt5 import QtCore, QtGui, QtWidgets
8 |
9 | class Ui_MainWindow(object):
10 | def setupUi(self, MainWindow):
11 | MainWindow.setObjectName("MainWindow")
12 | MainWindow.resize(676, 441)
13 | self.centralwidget = QtWidgets.QWidget(MainWindow)
14 | self.centralwidget.setObjectName("centralwidget")
15 | self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
16 | self.verticalLayout.setContentsMargins(0, 0, 0, 0)
17 | self.verticalLayout.setSpacing(0)
18 | self.verticalLayout.setObjectName("verticalLayout")
19 | self.frame = QtWidgets.QFrame(self.centralwidget)
20 | self.frame.setStyleSheet("background-color: rgb(255, 255, 255);")
21 | self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
22 | self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
23 | self.frame.setObjectName("frame")
24 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame)
25 | self.verticalLayout_2.setObjectName("verticalLayout_2")
26 | self.frame_2 = QtWidgets.QFrame(self.frame)
27 | self.frame_2.setStyleSheet("background-color: rgb(128, 111, 255);")
28 | self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
29 | self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
30 | self.frame_2.setObjectName("frame_2")
31 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame_2)
32 | self.horizontalLayout.setObjectName("horizontalLayout")
33 | self.bt_abrir = QtWidgets.QPushButton(self.frame_2)
34 | self.bt_abrir.setStyleSheet("QPushButton{\n"
35 | " \n"
36 | " background-color: rgb(0, 255, 127);\n"
37 | " font: 87 10pt \"Arial\";\n"
38 | "border:1px solid #000000;\n"
39 | " border-radius:5px;\n"
40 | "}\n"
41 | "\n"
42 | "QPushButton:hover {\n"
43 | " \n"
44 | " background-color: rgb(0, 0, 255);\n"
45 | " font: 87 10pt \"Arial\";\n"
46 | "border:1px solid #000000;\n"
47 | " border-radius:5px;\n"
48 | "}")
49 | self.bt_abrir.setObjectName("bt_abrir")
50 | self.horizontalLayout.addWidget(self.bt_abrir)
51 | self.pushButton = QtWidgets.QPushButton(self.frame_2)
52 | self.pushButton.setStyleSheet("QPushButton{\n"
53 | " \n"
54 | " background-color: rgb(0, 170, 0);\n"
55 | " font: 87 10pt \"Arial \";\n"
56 | "border:1px solid #000000;\n"
57 | " border-radius:5px;\n"
58 | "\n"
59 | "}\n"
60 | "\n"
61 | "QPushButton:hover{\n"
62 | " \n"
63 | " background-color: rgb(85, 255, 0);\n"
64 | " font: 87 10pt \"Arial \";\n"
65 | "border:1px solid #000000;\n"
66 | " border-radius:5px;\n"
67 | "\n"
68 | "}")
69 | self.pushButton.setObjectName("pushButton")
70 | self.horizontalLayout.addWidget(self.pushButton)
71 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
72 | self.horizontalLayout.addItem(spacerItem)
73 | self.label = QtWidgets.QLabel(self.frame_2)
74 | self.label.setStyleSheet("font: 75 20pt \"Rockwell Condensed\";")
75 | self.label.setObjectName("label")
76 | self.horizontalLayout.addWidget(self.label)
77 | spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
78 | self.horizontalLayout.addItem(spacerItem1)
79 | self.bt_salir = QtWidgets.QPushButton(self.frame_2)
80 | self.bt_salir.setStyleSheet("\n"
81 | "QPushButton{\n"
82 | " background-color: rgb(255, 0, 0);\n"
83 | " font: 87 10pt \"Arial\";\n"
84 | "border:1px solid #000000;\n"
85 | " border-radius:5px;\n"
86 | "\n"
87 | "}\n"
88 | "\n"
89 | "\n"
90 | "QPushButton:hover{\n"
91 | " \n"
92 | " background-color: rgb(255, 255, 255);\n"
93 | " font: 87 10pt \"Arial\";\n"
94 | "border:1px solid #000000;\n"
95 | " border-radius:5px;\n"
96 | "\n"
97 | "}")
98 | self.bt_salir.setObjectName("bt_salir")
99 | self.horizontalLayout.addWidget(self.bt_salir)
100 | self.verticalLayout_2.addWidget(self.frame_2)
101 | self.tableWidget = QtWidgets.QTableWidget(self.frame)
102 | self.tableWidget.setStyleSheet("QWidget {\n"
103 | " background-color: #ffffff;\n"
104 | " color: #000000;\n"
105 | "}\n"
106 | "\n"
107 | "QHeaderView::section {\n"
108 | " background-color: #aa00ff;\n"
109 | " padding: 2px;\n"
110 | "\n"
111 | " border: 1px solid #fffff8;\n"
112 | " font-size: 14pt;\n"
113 | "}\n"
114 | "\n"
115 | "QTableWidget {\n"
116 | " gridline-color: #aa00ff;\n"
117 | " font-size: 12pt;\n"
118 | "}\n"
119 | "\n"
120 | "QTableWidget QTableCornerButton::section {\n"
121 | " background-color: #646464;\n"
122 | " border: 1px solid #ff0000;\n"
123 | "}")
124 | self.tableWidget.setObjectName("tableWidget")
125 | self.tableWidget.setColumnCount(0)
126 | self.tableWidget.setRowCount(0)
127 | self.verticalLayout_2.addWidget(self.tableWidget)
128 | self.verticalLayout.addWidget(self.frame)
129 | self.verticalLayout.setStretch(0, 10)
130 | MainWindow.setCentralWidget(self.centralwidget)
131 | self.retranslateUi(MainWindow)
132 | self.bt_salir.clicked.connect(MainWindow.close)
133 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
134 | def retranslateUi(self, MainWindow):
135 | _translate = QtCore.QCoreApplication.translate
136 | MainWindow.setWindowTitle(_translate("MainWindow", "Leer archivos Excel"))
137 | self.bt_abrir.setText(_translate("MainWindow", "ABRIR ARCHIVO"))
138 | self.pushButton.setText(_translate("MainWindow", "MOSTRAR DATOS"))
139 | self.label.setText(_translate("MainWindow", "LEER ARCHIVOS EXCEL"))
140 | self.bt_salir.setText(_translate("MainWindow", "SALIR"))
141 | if __name__ == "__main__":
142 | import sys
143 | app = QtWidgets.QApplication(sys.argv)
144 | MainWindow = QtWidgets.QMainWindow()
145 | ui = Ui_MainWindow()
146 | ui.setupUi(MainWindow)
147 | MainWindow.show()
148 | sys.exit(app.exec_())
149 |
--------------------------------------------------------------------------------
/Menu Lateral desplegable/archivo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/archivo.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/barra-de-menus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/barra-de-menus.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/base-de-datos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/base-de-datos.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/cerrar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/cerrar.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/chip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/chip.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/encriptado.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/encriptado.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/imagen_dos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/imagen_dos.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/inteligencia-artificial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/inteligencia-artificial.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/main.py:
--------------------------------------------------------------------------------
1 | # @autor: Magno Efren
2 | # Youtube: https://www.youtube.com/c/MagnoEfren
3 | import sys
4 | from menu import *
5 | from PyQt5 import QtCore
6 | from PyQt5.QtCore import QPropertyAnimation
7 | from PyQt5 import QtCore, QtGui, QtWidgets
8 | class MiApp(QtWidgets.QMainWindow):
9 | def __init__(self):
10 | super().__init__()
11 | self.ui = Ui_MainWindow()
12 | self.ui.setupUi(self)
13 | #eliminar barra y de titulo - opacidad
14 | self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
15 | self.setWindowOpacity(1)
16 | #SizeGrip
17 | self.gripSize = 10
18 | self.grip = QtWidgets.QSizeGrip(self)
19 | self.grip.resize(self.gripSize, self.gripSize)
20 | # mover ventana
21 | self.ui.frame_superior.mouseMoveEvent = self.mover_ventana
22 | #acceder a las paginas
23 | self.ui.bt_inicio.clicked.connect(lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.page))
24 | self.ui.bt_uno.clicked.connect(lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.page_uno))
25 | self.ui.bt_dos.clicked.connect(lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.page_dos))
26 | self.ui.bt_tres.clicked.connect(lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.page_tres))
27 | self.ui.bt_cuatro.clicked.connect(lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.page_cuatro))
28 | self.ui.bt_cinco.clicked.connect(lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.page_cinco))
29 |
30 | #control barra de titulos
31 | self.ui.bt_minimizar.clicked.connect(self.control_bt_minimizar)
32 | self.ui.bt_restaurar.clicked.connect(self.control_bt_normal)
33 | self.ui.bt_maximizar.clicked.connect(self.control_bt_maximizar)
34 | self.ui.bt_cerrar.clicked.connect(lambda: self.close())
35 |
36 | self.ui.bt_restaurar.hide()
37 |
38 | #menu lateral
39 | self.ui.bt_menu.clicked.connect(self.mover_menu)
40 |
41 | def control_bt_minimizar(self):
42 | self.showMinimized()
43 |
44 | def control_bt_normal(self):
45 | self.showNormal()
46 | self.ui.bt_restaurar.hide()
47 | self.ui.bt_maximizar.show()
48 |
49 | def control_bt_maximizar(self):
50 | self.showMaximized()
51 | self.ui.bt_maximizar.hide()
52 | self.ui.bt_restaurar.show()
53 |
54 | def mover_menu(self):
55 | if True:
56 | width = self.ui.frame_lateral.width()
57 | normal = 0
58 | if width==0:
59 | extender = 200
60 | else:
61 | extender = normal
62 | self.animacion = QPropertyAnimation(self.ui.frame_lateral, b'minimumWidth')
63 | self.animacion.setDuration(300)
64 | self.animacion.setStartValue(width)
65 | self.animacion.setEndValue(extender)
66 | self.animacion.setEasingCurve(QtCore.QEasingCurve.InOutQuart)
67 | self.animacion.start()
68 | ## SizeGrip
69 | def resizeEvent(self, event):
70 | rect = self.rect()
71 | self.grip.move(rect.right() - self.gripSize, rect.bottom() - self.gripSize)
72 | ## mover ventana
73 | def mousePressEvent(self, event):
74 | self.clickPosition = event.globalPos()
75 | def mover_ventana(self, event):
76 | if self.isMaximized() == False:
77 | if event.buttons() == QtCore.Qt.LeftButton:
78 | self.move(self.pos() + event.globalPos() - self.clickPosition)
79 | self.clickPosition = event.globalPos()
80 | event.accept()
81 |
82 | if event.globalPos().y() <=20:
83 | self.showMaximized()
84 | else:
85 | self.showNormal()
86 | if __name__ == "__main__":
87 | app = QtWidgets.QApplication(sys.argv)
88 | mi_app = MiApp()
89 | mi_app.show()
90 | sys.exit(app.exec_())
91 |
--------------------------------------------------------------------------------
/Menu Lateral desplegable/maximizar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/maximizar.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/menu.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'menu.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.15.4
6 | #
7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is
8 | # run again. Do not edit this file unless you know what you are doing.
9 | from PyQt5 import QtCore, QtGui, QtWidgets
10 | class Ui_MainWindow(object):
11 | def setupUi(self, MainWindow):
12 | MainWindow.setObjectName("MainWindow")
13 | MainWindow.resize(756, 461)
14 | MainWindow.setMinimumSize(QtCore.QSize(400, 0))
15 | MainWindow.setStyleSheet("")
16 | self.centralwidget = QtWidgets.QWidget(MainWindow)
17 | self.centralwidget.setObjectName("centralwidget")
18 | self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
19 | self.verticalLayout.setContentsMargins(0, 0, 0, 0)
20 | self.verticalLayout.setSpacing(0)
21 | self.verticalLayout.setObjectName("verticalLayout")
22 | self.frame_superior = QtWidgets.QFrame(self.centralwidget)
23 | self.frame_superior.setMinimumSize(QtCore.QSize(0, 35))
24 | self.frame_superior.setMaximumSize(QtCore.QSize(16777215, 50))
25 | self.frame_superior.setStyleSheet("\n"
26 | "QFrame{\n"
27 | "border-top-left-radius: 20px;\n"
28 | "border-bottom-left-radius: 20px;\n"
29 | "\n"
30 | "background-color: rgb(170, 0, 255);\n"
31 | "\n"
32 | "}\n"
33 | "")
34 | self.frame_superior.setFrameShape(QtWidgets.QFrame.StyledPanel)
35 | self.frame_superior.setFrameShadow(QtWidgets.QFrame.Raised)
36 | self.frame_superior.setObjectName("frame_superior")
37 | self.horizontalLayout_8 = QtWidgets.QHBoxLayout(self.frame_superior)
38 | self.horizontalLayout_8.setContentsMargins(2, 0, 2, 0)
39 | self.horizontalLayout_8.setSpacing(0)
40 | self.horizontalLayout_8.setObjectName("horizontalLayout_8")
41 | self.bt_menu = QtWidgets.QPushButton(self.frame_superior)
42 | self.bt_menu.setMinimumSize(QtCore.QSize(200, 0))
43 | self.bt_menu.setMaximumSize(QtCore.QSize(200, 16777215))
44 | self.bt_menu.setStyleSheet("QPushButton{\n"
45 | "background-color: #aa00ff;\n"
46 | "font: 87 12pt \"Arial Black\";\n"
47 | "border-radius:0px;\n"
48 | "}\n"
49 | "\n"
50 | "QPushButton:hover{\n"
51 | "background-color: white;\n"
52 | "font: 87 12pt \"Arial Black\";\n"
53 | "\n"
54 | "}\n"
55 | "")
56 | icon = QtGui.QIcon()
57 | icon.addPixmap(QtGui.QPixmap("barra-de-menus.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
58 | self.bt_menu.setIcon(icon)
59 | self.bt_menu.setIconSize(QtCore.QSize(32, 32))
60 | self.bt_menu.setAutoDefault(False)
61 | self.bt_menu.setDefault(False)
62 | self.bt_menu.setFlat(False)
63 | self.bt_menu.setObjectName("bt_menu")
64 | self.horizontalLayout_8.addWidget(self.bt_menu, 0, QtCore.Qt.AlignLeft)
65 | spacerItem = QtWidgets.QSpacerItem(265, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
66 | self.horizontalLayout_8.addItem(spacerItem)
67 | self.bt_minimizar = QtWidgets.QPushButton(self.frame_superior)
68 | self.bt_minimizar.setMinimumSize(QtCore.QSize(35, 35))
69 | self.bt_minimizar.setStyleSheet("QPushButton{\n"
70 | "border:0px;\n"
71 | "}\n"
72 | "\n"
73 | "QPushButton:hover{\n"
74 | "border:5px solid #aa00ff;\n"
75 | "background-color:#ffff00;\n"
76 | "\n"
77 | "}\n"
78 | "")
79 | self.bt_minimizar.setText("")
80 | icon1 = QtGui.QIcon()
81 | icon1.addPixmap(QtGui.QPixmap("minimizar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
82 | self.bt_minimizar.setIcon(icon1)
83 | self.bt_minimizar.setIconSize(QtCore.QSize(32, 32))
84 | self.bt_minimizar.setFlat(False)
85 | self.bt_minimizar.setObjectName("bt_minimizar")
86 | self.horizontalLayout_8.addWidget(self.bt_minimizar, 0, QtCore.Qt.AlignRight)
87 | self.bt_restaurar = QtWidgets.QPushButton(self.frame_superior)
88 | self.bt_restaurar.setMaximumSize(QtCore.QSize(35, 35))
89 | self.bt_restaurar.setStyleSheet("QPushButton{\n"
90 | "border:0px;\n"
91 | "\n"
92 | "}\n"
93 | "\n"
94 | "QPushButton:hover{\n"
95 | "border:5px solid #aa00ff;\n"
96 | "background-color:#55ff00;\n"
97 | "\n"
98 | "}\n"
99 | "")
100 | self.bt_restaurar.setText("")
101 | icon2 = QtGui.QIcon()
102 | icon2.addPixmap(QtGui.QPixmap("restaurar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
103 | self.bt_restaurar.setIcon(icon2)
104 | self.bt_restaurar.setIconSize(QtCore.QSize(30, 30))
105 | self.bt_restaurar.setObjectName("bt_restaurar")
106 | self.horizontalLayout_8.addWidget(self.bt_restaurar, 0, QtCore.Qt.AlignRight)
107 | self.bt_maximizar = QtWidgets.QPushButton(self.frame_superior)
108 | self.bt_maximizar.setMaximumSize(QtCore.QSize(35, 35))
109 | self.bt_maximizar.setStyleSheet("QPushButton{\n"
110 | "border:0px;\n"
111 | "\n"
112 | "}\n"
113 | "\n"
114 | "QPushButton:hover{\n"
115 | "border:5px solid #aa00ff;\n"
116 | "background-color:#55ff00;\n"
117 | "\n"
118 | "}\n"
119 | "")
120 | self.bt_maximizar.setText("")
121 | icon3 = QtGui.QIcon()
122 | icon3.addPixmap(QtGui.QPixmap("maximizar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
123 | self.bt_maximizar.setIcon(icon3)
124 | self.bt_maximizar.setIconSize(QtCore.QSize(32, 32))
125 | self.bt_maximizar.setObjectName("bt_maximizar")
126 | self.horizontalLayout_8.addWidget(self.bt_maximizar, 0, QtCore.Qt.AlignRight)
127 | self.bt_cerrar = QtWidgets.QPushButton(self.frame_superior)
128 | self.bt_cerrar.setMaximumSize(QtCore.QSize(35, 16777215))
129 | self.bt_cerrar.setStyleSheet("QPushButton{\n"
130 | "border:0px;\n"
131 | "\n"
132 | "}\n"
133 | "\n"
134 | "QPushButton:hover{\n"
135 | "border:5px solid #aa00ff;\n"
136 | "background-color:red;\n"
137 | "\n"
138 | "}\n"
139 | "")
140 | self.bt_cerrar.setText("")
141 | icon4 = QtGui.QIcon()
142 | icon4.addPixmap(QtGui.QPixmap("cerrar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
143 | self.bt_cerrar.setIcon(icon4)
144 | self.bt_cerrar.setIconSize(QtCore.QSize(32, 32))
145 | self.bt_cerrar.setObjectName("bt_cerrar")
146 | self.horizontalLayout_8.addWidget(self.bt_cerrar, 0, QtCore.Qt.AlignRight)
147 | self.verticalLayout.addWidget(self.frame_superior)
148 | self.frame_inferior = QtWidgets.QFrame(self.centralwidget)
149 | self.frame_inferior.setStyleSheet("")
150 | self.frame_inferior.setFrameShape(QtWidgets.QFrame.StyledPanel)
151 | self.frame_inferior.setFrameShadow(QtWidgets.QFrame.Raised)
152 | self.frame_inferior.setObjectName("frame_inferior")
153 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame_inferior)
154 | self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
155 | self.horizontalLayout.setSpacing(0)
156 | self.horizontalLayout.setObjectName("horizontalLayout")
157 | self.frame_lateral = QtWidgets.QFrame(self.frame_inferior)
158 | self.frame_lateral.setMinimumSize(QtCore.QSize(200, 0))
159 | self.frame_lateral.setMaximumSize(QtCore.QSize(0, 16777215))
160 | self.frame_lateral.setLayoutDirection(QtCore.Qt.LeftToRight)
161 | self.frame_lateral.setAutoFillBackground(False)
162 | self.frame_lateral.setStyleSheet("\n"
163 | "QFrame{\n"
164 | "background-color:#aa55ff;\n"
165 | "}\n"
166 | "\n"
167 | "\n"
168 | "\n"
169 | "QPushButton{\n"
170 | "background-color: #aa55ff;\n"
171 | "border-top-left-radius: 20px;\n"
172 | "border-bottom-left-radius: 20px;\n"
173 | "\n"
174 | "font: 75 12pt \"Arial Narrow\";\n"
175 | " \n"
176 | "}\n"
177 | "\n"
178 | "QPushButton:hover{\n"
179 | "background-color: white;\n"
180 | "border-top-left-radius: 20px;\n"
181 | "border-bottom-left-radius: 20px;\n"
182 | "\n"
183 | "font: 75 12pt \"Arial Narrow\";\n"
184 | "}")
185 | self.frame_lateral.setFrameShape(QtWidgets.QFrame.StyledPanel)
186 | self.frame_lateral.setFrameShadow(QtWidgets.QFrame.Plain)
187 | self.frame_lateral.setObjectName("frame_lateral")
188 | self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame_lateral)
189 | self.verticalLayout_2.setContentsMargins(0, -1, 0, 9)
190 | self.verticalLayout_2.setSpacing(20)
191 | self.verticalLayout_2.setObjectName("verticalLayout_2")
192 | self.bt_inicio = QtWidgets.QPushButton(self.frame_lateral)
193 | self.bt_inicio.setMinimumSize(QtCore.QSize(0, 40))
194 | self.bt_inicio.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
195 | self.bt_inicio.setLayoutDirection(QtCore.Qt.LeftToRight)
196 | icon5 = QtGui.QIcon()
197 | icon5.addPixmap(QtGui.QPixmap("inteligencia-artificial.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
198 | self.bt_inicio.setIcon(icon5)
199 | self.bt_inicio.setIconSize(QtCore.QSize(32, 32))
200 | self.bt_inicio.setObjectName("bt_inicio")
201 | self.verticalLayout_2.addWidget(self.bt_inicio)
202 | self.bt_uno = QtWidgets.QPushButton(self.frame_lateral)
203 | self.bt_uno.setMinimumSize(QtCore.QSize(0, 40))
204 | self.bt_uno.setToolTipDuration(0)
205 | self.bt_uno.setStyleSheet("")
206 | icon6 = QtGui.QIcon()
207 | icon6.addPixmap(QtGui.QPixmap("base-de-datos.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
208 | self.bt_uno.setIcon(icon6)
209 | self.bt_uno.setIconSize(QtCore.QSize(32, 32))
210 | self.bt_uno.setObjectName("bt_uno")
211 | self.verticalLayout_2.addWidget(self.bt_uno)
212 | self.bt_dos = QtWidgets.QPushButton(self.frame_lateral)
213 | self.bt_dos.setMinimumSize(QtCore.QSize(0, 40))
214 | self.bt_dos.setStyleSheet("")
215 | icon7 = QtGui.QIcon()
216 | icon7.addPixmap(QtGui.QPixmap("chip.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
217 | self.bt_dos.setIcon(icon7)
218 | self.bt_dos.setIconSize(QtCore.QSize(32, 32))
219 | self.bt_dos.setObjectName("bt_dos")
220 | self.verticalLayout_2.addWidget(self.bt_dos)
221 | self.bt_tres = QtWidgets.QPushButton(self.frame_lateral)
222 | self.bt_tres.setMinimumSize(QtCore.QSize(0, 40))
223 | self.bt_tres.setStyleSheet("")
224 | icon8 = QtGui.QIcon()
225 | icon8.addPixmap(QtGui.QPixmap("moto.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
226 | self.bt_tres.setIcon(icon8)
227 | self.bt_tres.setIconSize(QtCore.QSize(32, 32))
228 | self.bt_tres.setObjectName("bt_tres")
229 | self.verticalLayout_2.addWidget(self.bt_tres)
230 | self.bt_cuatro = QtWidgets.QPushButton(self.frame_lateral)
231 | self.bt_cuatro.setMinimumSize(QtCore.QSize(0, 40))
232 | self.bt_cuatro.setStyleSheet("")
233 | icon9 = QtGui.QIcon()
234 | icon9.addPixmap(QtGui.QPixmap("encriptado.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
235 | self.bt_cuatro.setIcon(icon9)
236 | self.bt_cuatro.setIconSize(QtCore.QSize(32, 32))
237 | self.bt_cuatro.setObjectName("bt_cuatro")
238 | self.verticalLayout_2.addWidget(self.bt_cuatro)
239 | self.bt_cinco = QtWidgets.QPushButton(self.frame_lateral)
240 | self.bt_cinco.setMinimumSize(QtCore.QSize(0, 40))
241 | self.bt_cinco.setStyleSheet("")
242 | icon10 = QtGui.QIcon()
243 | icon10.addPixmap(QtGui.QPixmap("videojuego.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
244 | self.bt_cinco.setIcon(icon10)
245 | self.bt_cinco.setIconSize(QtCore.QSize(32, 32))
246 | self.bt_cinco.setObjectName("bt_cinco")
247 | self.verticalLayout_2.addWidget(self.bt_cinco)
248 | spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
249 | self.verticalLayout_2.addItem(spacerItem1)
250 | self.label_2 = QtWidgets.QLabel(self.frame_lateral)
251 | self.label_2.setStyleSheet("font: italic 15pt \"Vivaldi\";")
252 | self.label_2.setAlignment(QtCore.Qt.AlignCenter)
253 | self.label_2.setObjectName("label_2")
254 | self.verticalLayout_2.addWidget(self.label_2)
255 | self.horizontalLayout.addWidget(self.frame_lateral, 0, QtCore.Qt.AlignLeft)
256 | self.frame_contenedor = QtWidgets.QFrame(self.frame_inferior)
257 | self.frame_contenedor.setStyleSheet("")
258 | self.frame_contenedor.setFrameShape(QtWidgets.QFrame.StyledPanel)
259 | self.frame_contenedor.setFrameShadow(QtWidgets.QFrame.Raised)
260 | self.frame_contenedor.setLineWidth(1)
261 | self.frame_contenedor.setObjectName("frame_contenedor")
262 | self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.frame_contenedor)
263 | self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
264 | self.verticalLayout_3.setSpacing(0)
265 | self.verticalLayout_3.setObjectName("verticalLayout_3")
266 | self.stackedWidget = QtWidgets.QStackedWidget(self.frame_contenedor)
267 | self.stackedWidget.setMinimumSize(QtCore.QSize(0, 0))
268 | self.stackedWidget.setStyleSheet("background-color: rgb(255, 255, 255);")
269 | self.stackedWidget.setFrameShape(QtWidgets.QFrame.NoFrame)
270 | self.stackedWidget.setFrameShadow(QtWidgets.QFrame.Plain)
271 | self.stackedWidget.setLineWidth(0)
272 | self.stackedWidget.setObjectName("stackedWidget")
273 | self.page = QtWidgets.QWidget()
274 | self.page.setObjectName("page")
275 | self.verticalLayout_9 = QtWidgets.QVBoxLayout(self.page)
276 | self.verticalLayout_9.setObjectName("verticalLayout_9")
277 | self.label = QtWidgets.QLabel(self.page)
278 | self.label.setText("")
279 | self.label.setPixmap(QtGui.QPixmap("imagen_dos.png"))
280 | self.label.setScaledContents(False)
281 | self.label.setAlignment(QtCore.Qt.AlignCenter)
282 | self.label.setIndent(0)
283 | self.label.setObjectName("label")
284 | self.verticalLayout_9.addWidget(self.label)
285 | self.stackedWidget.addWidget(self.page)
286 | self.page_uno = QtWidgets.QWidget()
287 | self.page_uno.setStyleSheet("background-color: rgb(255, 255, 255);")
288 | self.page_uno.setObjectName("page_uno")
289 | self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.page_uno)
290 | self.verticalLayout_4.setObjectName("verticalLayout_4")
291 | self.pushButton_5 = QtWidgets.QPushButton(self.page_uno)
292 | self.pushButton_5.setStyleSheet("background-color: rgb(85, 170, 255);\n"
293 | "font: 87 36pt \"Arial Black\";")
294 | self.pushButton_5.setObjectName("pushButton_5")
295 | self.verticalLayout_4.addWidget(self.pushButton_5)
296 | self.stackedWidget.addWidget(self.page_uno)
297 | self.page_dos = QtWidgets.QWidget()
298 | self.page_dos.setStyleSheet("background-color: rgb(255, 255, 255);")
299 | self.page_dos.setObjectName("page_dos")
300 | self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.page_dos)
301 | self.verticalLayout_5.setObjectName("verticalLayout_5")
302 | self.pushButton_4 = QtWidgets.QPushButton(self.page_dos)
303 | self.pushButton_4.setStyleSheet("background-color: rgb(255, 0, 127);\n"
304 | "font: 87 36pt \"Arial Black\";")
305 | self.pushButton_4.setObjectName("pushButton_4")
306 | self.verticalLayout_5.addWidget(self.pushButton_4)
307 | self.stackedWidget.addWidget(self.page_dos)
308 | self.page_tres = QtWidgets.QWidget()
309 | self.page_tres.setObjectName("page_tres")
310 | self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.page_tres)
311 | self.verticalLayout_6.setObjectName("verticalLayout_6")
312 | self.pushButton_3 = QtWidgets.QPushButton(self.page_tres)
313 | self.pushButton_3.setStyleSheet("background-color: rgb(255, 255, 0);\n"
314 | "font: 87 36pt \"Arial Black\";")
315 | self.pushButton_3.setObjectName("pushButton_3")
316 | self.verticalLayout_6.addWidget(self.pushButton_3)
317 | self.stackedWidget.addWidget(self.page_tres)
318 | self.page_cuatro = QtWidgets.QWidget()
319 | self.page_cuatro.setStyleSheet("background-color: rgb(255, 255, 255);")
320 | self.page_cuatro.setObjectName("page_cuatro")
321 | self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.page_cuatro)
322 | self.verticalLayout_7.setObjectName("verticalLayout_7")
323 | self.pushButton_2 = QtWidgets.QPushButton(self.page_cuatro)
324 | self.pushButton_2.setStyleSheet("background-color: rgb(85, 255, 0);\n"
325 | "font: 87 36pt \"Arial Black\";")
326 | self.pushButton_2.setObjectName("pushButton_2")
327 | self.verticalLayout_7.addWidget(self.pushButton_2)
328 | self.stackedWidget.addWidget(self.page_cuatro)
329 | self.page_cinco = QtWidgets.QWidget()
330 | self.page_cinco.setStyleSheet("background-color: rgb(255, 255, 255);")
331 | self.page_cinco.setObjectName("page_cinco")
332 | self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.page_cinco)
333 | self.verticalLayout_8.setObjectName("verticalLayout_8")
334 | self.pushButton = QtWidgets.QPushButton(self.page_cinco)
335 | self.pushButton.setStyleSheet("background-color: rgb(0, 170, 255);\n"
336 | "font: 87 36pt \"Arial Black\";")
337 | self.pushButton.setObjectName("pushButton")
338 | self.verticalLayout_8.addWidget(self.pushButton)
339 | self.stackedWidget.addWidget(self.page_cinco)
340 | self.verticalLayout_3.addWidget(self.stackedWidget)
341 | self.horizontalLayout.addWidget(self.frame_contenedor)
342 | self.verticalLayout.addWidget(self.frame_inferior)
343 | MainWindow.setCentralWidget(self.centralwidget)
344 |
345 | self.retranslateUi(MainWindow)
346 | self.stackedWidget.setCurrentIndex(0)
347 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
348 |
349 | def retranslateUi(self, MainWindow):
350 | _translate = QtCore.QCoreApplication.translate
351 | MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
352 | self.bt_menu.setText(_translate("MainWindow", " MENU "))
353 | self.bt_inicio.setText(_translate("MainWindow", " INICIO "))
354 | self.bt_uno.setText(_translate("MainWindow", " BASE DE DATOS"))
355 | self.bt_dos.setText(_translate("MainWindow", " ELECTRONICA"))
356 | self.bt_tres.setText(_translate("MainWindow", " TECNOLOGIA"))
357 | self.bt_cuatro.setText(_translate("MainWindow", " SEGURIDAD"))
358 | self.bt_cinco.setText(_translate("MainWindow", " CONECTIVIDAD"))
359 | self.label_2.setText(_translate("MainWindow", "Python - PySide2"))
360 | self.pushButton_5.setText(_translate("MainWindow", "1"))
361 | self.pushButton_4.setText(_translate("MainWindow", "2"))
362 | self.pushButton_3.setText(_translate("MainWindow", "3"))
363 | self.pushButton_2.setText(_translate("MainWindow", "4"))
364 | self.pushButton.setText(_translate("MainWindow", "5"))
365 |
366 |
367 | if __name__ == "__main__":
368 | import sys
369 | app = QtWidgets.QApplication(sys.argv)
370 | MainWindow = QtWidgets.QMainWindow()
371 | ui = Ui_MainWindow()
372 | ui.setupUi(MainWindow)
373 | MainWindow.show()
374 | sys.exit(app.exec_())
375 |
--------------------------------------------------------------------------------
/Menu Lateral desplegable/menu.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 756
10 | 461
11 |
12 |
13 |
14 |
15 | 400
16 | 0
17 |
18 |
19 |
20 | MainWindow
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | 0
29 |
30 |
31 | 0
32 |
33 |
34 | 0
35 |
36 |
37 | 0
38 |
39 |
40 | 0
41 |
42 | -
43 |
44 |
45 |
46 | 0
47 | 35
48 |
49 |
50 |
51 |
52 | 16777215
53 | 50
54 |
55 |
56 |
57 |
58 | QFrame{
59 | border-top-left-radius: 20px;
60 | border-bottom-left-radius: 20px;
61 |
62 | background-color: rgb(170, 0, 255);
63 |
64 | }
65 |
66 |
67 |
68 | QFrame::StyledPanel
69 |
70 |
71 | QFrame::Raised
72 |
73 |
74 |
75 | 0
76 |
77 |
78 | 2
79 |
80 |
81 | 0
82 |
83 |
84 | 2
85 |
86 |
87 | 0
88 |
89 |
-
90 |
91 |
92 |
93 | 200
94 | 0
95 |
96 |
97 |
98 |
99 | 200
100 | 16777215
101 |
102 |
103 |
104 | QPushButton{
105 | background-color: #aa00ff;
106 | font: 87 12pt "Arial Black";
107 | border-radius:0px;
108 | }
109 |
110 | QPushButton:hover{
111 | background-color: white;
112 | font: 87 12pt "Arial Black";
113 |
114 | }
115 |
116 |
117 |
118 | MENU
119 |
120 |
121 |
122 | barra-de-menus.pngbarra-de-menus.png
123 |
124 |
125 |
126 | 32
127 | 32
128 |
129 |
130 |
131 | false
132 |
133 |
134 | false
135 |
136 |
137 | false
138 |
139 |
140 |
141 | -
142 |
143 |
144 | Qt::Horizontal
145 |
146 |
147 |
148 | 265
149 | 20
150 |
151 |
152 |
153 |
154 | -
155 |
156 |
157 |
158 | 35
159 | 35
160 |
161 |
162 |
163 | QPushButton{
164 | border:0px;
165 | }
166 |
167 | QPushButton:hover{
168 | border:5px solid #aa00ff;
169 | background-color:#ffff00;
170 |
171 | }
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 | minimizar.pngminimizar.png
180 |
181 |
182 |
183 | 32
184 | 32
185 |
186 |
187 |
188 | false
189 |
190 |
191 |
192 | -
193 |
194 |
195 |
196 | 35
197 | 35
198 |
199 |
200 |
201 | QPushButton{
202 | border:0px;
203 |
204 | }
205 |
206 | QPushButton:hover{
207 | border:5px solid #aa00ff;
208 | background-color:#55ff00;
209 |
210 | }
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 | restaurar.pngrestaurar.png
219 |
220 |
221 |
222 | 30
223 | 30
224 |
225 |
226 |
227 |
228 | -
229 |
230 |
231 |
232 | 35
233 | 35
234 |
235 |
236 |
237 | QPushButton{
238 | border:0px;
239 |
240 | }
241 |
242 | QPushButton:hover{
243 | border:5px solid #aa00ff;
244 | background-color:#55ff00;
245 |
246 | }
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 | maximizar.pngmaximizar.png
255 |
256 |
257 |
258 | 32
259 | 32
260 |
261 |
262 |
263 |
264 | -
265 |
266 |
267 |
268 | 35
269 | 16777215
270 |
271 |
272 |
273 | QPushButton{
274 | border:0px;
275 |
276 | }
277 |
278 | QPushButton:hover{
279 | border:5px solid #aa00ff;
280 | background-color:red;
281 |
282 | }
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 | cerrar.pngcerrar.png
291 |
292 |
293 |
294 | 32
295 | 32
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 | -
304 |
305 |
306 |
307 |
308 |
309 | QFrame::StyledPanel
310 |
311 |
312 | QFrame::Raised
313 |
314 |
315 |
316 | 0
317 |
318 |
319 | 0
320 |
321 |
322 | 0
323 |
324 |
325 | 0
326 |
327 |
328 | 0
329 |
330 |
-
331 |
332 |
333 |
334 | 200
335 | 0
336 |
337 |
338 |
339 |
340 | 0
341 | 16777215
342 |
343 |
344 |
345 | Qt::LeftToRight
346 |
347 |
348 | false
349 |
350 |
351 |
352 | QFrame{
353 | background-color:#aa55ff;
354 | }
355 |
356 |
357 |
358 | QPushButton{
359 | background-color: #aa55ff;
360 | border-top-left-radius: 20px;
361 | border-bottom-left-radius: 20px;
362 |
363 | font: 75 12pt "Arial Narrow";
364 |
365 | }
366 |
367 | QPushButton:hover{
368 | background-color: white;
369 | border-top-left-radius: 20px;
370 | border-bottom-left-radius: 20px;
371 |
372 | font: 75 12pt "Arial Narrow";
373 | }
374 |
375 |
376 | QFrame::StyledPanel
377 |
378 |
379 | QFrame::Plain
380 |
381 |
382 |
383 | 20
384 |
385 |
386 | 0
387 |
388 |
389 | 0
390 |
391 |
392 | 9
393 |
394 |
-
395 |
396 |
397 |
398 | 0
399 | 40
400 |
401 |
402 |
403 | Qt::DefaultContextMenu
404 |
405 |
406 | Qt::LeftToRight
407 |
408 |
409 | INICIO
410 |
411 |
412 |
413 | inteligencia-artificial.pnginteligencia-artificial.png
414 |
415 |
416 |
417 | 32
418 | 32
419 |
420 |
421 |
422 |
423 | -
424 |
425 |
426 |
427 | 0
428 | 40
429 |
430 |
431 |
432 | 0
433 |
434 |
435 |
436 |
437 |
438 | BASE DE DATOS
439 |
440 |
441 |
442 | base-de-datos.pngbase-de-datos.png
443 |
444 |
445 |
446 | 32
447 | 32
448 |
449 |
450 |
451 |
452 | -
453 |
454 |
455 |
456 | 0
457 | 40
458 |
459 |
460 |
461 |
462 |
463 |
464 | ELECTRONICA
465 |
466 |
467 |
468 | chip.pngchip.png
469 |
470 |
471 |
472 | 32
473 | 32
474 |
475 |
476 |
477 |
478 | -
479 |
480 |
481 |
482 | 0
483 | 40
484 |
485 |
486 |
487 |
488 |
489 |
490 | TECNOLOGIA
491 |
492 |
493 |
494 | moto.pngmoto.png
495 |
496 |
497 |
498 | 32
499 | 32
500 |
501 |
502 |
503 |
504 | -
505 |
506 |
507 |
508 | 0
509 | 40
510 |
511 |
512 |
513 |
514 |
515 |
516 | SEGURIDAD
517 |
518 |
519 |
520 | encriptado.pngencriptado.png
521 |
522 |
523 |
524 | 32
525 | 32
526 |
527 |
528 |
529 |
530 | -
531 |
532 |
533 |
534 | 0
535 | 40
536 |
537 |
538 |
539 |
540 |
541 |
542 | CONECTIVIDAD
543 |
544 |
545 |
546 | videojuego.pngvideojuego.png
547 |
548 |
549 |
550 | 32
551 | 32
552 |
553 |
554 |
555 |
556 | -
557 |
558 |
559 | Qt::Vertical
560 |
561 |
562 |
563 | 20
564 | 40
565 |
566 |
567 |
568 |
569 | -
570 |
571 |
572 | font: italic 15pt "Vivaldi";
573 |
574 |
575 | Python - PySide2
576 |
577 |
578 | Qt::AlignCenter
579 |
580 |
581 |
582 |
583 |
584 |
585 | -
586 |
587 |
588 |
589 |
590 |
591 | QFrame::StyledPanel
592 |
593 |
594 | QFrame::Raised
595 |
596 |
597 | 1
598 |
599 |
600 |
601 | 0
602 |
603 |
604 | 0
605 |
606 |
607 | 0
608 |
609 |
610 | 0
611 |
612 |
613 | 0
614 |
615 |
-
616 |
617 |
618 |
619 | 0
620 | 0
621 |
622 |
623 |
624 | background-color: rgb(255, 255, 255);
625 |
626 |
627 | QFrame::NoFrame
628 |
629 |
630 | QFrame::Plain
631 |
632 |
633 | 0
634 |
635 |
636 | 0
637 |
638 |
639 |
640 |
-
641 |
642 |
643 |
644 |
645 |
646 | imagen_dos.png
647 |
648 |
649 | false
650 |
651 |
652 | Qt::AlignCenter
653 |
654 |
655 | 0
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 | background-color: rgb(255, 255, 255);
664 |
665 |
666 | -
667 |
668 |
669 | background-color: rgb(85, 170, 255);
670 | font: 87 36pt "Arial Black";
671 |
672 |
673 | 1
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 | background-color: rgb(255, 255, 255);
682 |
683 |
684 | -
685 |
686 |
687 | background-color: rgb(255, 0, 127);
688 | font: 87 36pt "Arial Black";
689 |
690 |
691 | 2
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 | -
700 |
701 |
702 | background-color: rgb(255, 255, 0);
703 | font: 87 36pt "Arial Black";
704 |
705 |
706 | 3
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 | background-color: rgb(255, 255, 255);
715 |
716 |
717 | -
718 |
719 |
720 | background-color: rgb(85, 255, 0);
721 | font: 87 36pt "Arial Black";
722 |
723 |
724 | 4
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 | background-color: rgb(255, 255, 255);
733 |
734 |
735 | -
736 |
737 |
738 | background-color: rgb(0, 170, 255);
739 | font: 87 36pt "Arial Black";
740 |
741 |
742 | 5
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
--------------------------------------------------------------------------------
/Menu Lateral desplegable/minimizar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/minimizar.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/moto.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/moto.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/restaurar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/restaurar.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/screenshot.png
--------------------------------------------------------------------------------
/Menu Lateral desplegable/videojuego.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/Menu Lateral desplegable/videojuego.png
--------------------------------------------------------------------------------
/ProgressBarCircular con ardino/codigo_arduino/codigo_arduino.ino:
--------------------------------------------------------------------------------
1 | // https://www.youtube.com/c/MagnoEfren
2 | // Señal analógica en PorgressBar Circular en PySide2 / PyQt5
3 |
4 | float lectura;
5 | float voltaje;
6 |
7 | void setup() {
8 |
9 | Serial.begin(9600);
10 | pinMode(A0,INPUT);
11 | }
12 |
13 | void loop() {
14 | lectura = analogRead(A0);
15 | voltaje = ((lectura/1023)*5.5);
16 |
17 | Serial.println(voltaje);
18 |
19 | delay(200);
20 | }
21 |
--------------------------------------------------------------------------------
/ProgressBarCircular con ardino/comunicacion_serial.py:
--------------------------------------------------------------------------------
1 | # ProgressBar Circular Arduino y PyQt5
2 | # @autor: Magno Efren
3 | # Youtube: https://www.youtube.com/c/MagnoEfren
4 |
5 | from PyQt5.QtCore import QObject, pyqtSignal,pyqtSlot
6 | import serial, serial.tools.list_ports
7 | from threading import Thread, Event
8 |
9 | class Comunicacion(QObject):
10 | datos_recibidos = pyqtSignal(str)
11 |
12 | def __init__(self):
13 | super().__init__()
14 | self.arduino = serial.Serial()
15 | self.arduino.timeout = 0.5
16 |
17 | self.baudrates = ['1200', '2400', '4800', '9600', '19200', '38400', '115200']
18 | self.puertos = []
19 |
20 | self.hilo = None
21 | self.alive = Event() #indica que esta activo
22 |
23 | def puertos_disponibles(self):
24 | self.puertos = [port.device for port in serial.tools.list_ports.comports()]
25 |
26 | def conexion_serial(self):
27 | try:
28 | self.arduino.open()
29 | except:
30 | pass
31 |
32 | if (self.arduino.is_open): # iniciamos el hilo cuando puerto esta abierto
33 | self.iniciar_hilo()
34 |
35 |
36 | def desconectar(self):
37 | self.stop_hilo()
38 | self.arduino.close()
39 |
40 | def leer_datos(self):
41 | while(self.alive.isSet() and self.arduino.is_open):
42 |
43 | data = self.arduino.readline().decode("utf-8").strip()
44 | if(len(data)>1):
45 | self.datos_recibidos.emit(data)
46 |
47 |
48 | def iniciar_hilo(self):
49 | self.hilo = Thread(target= self.leer_datos)
50 | self.hilo.setDaemon(1)
51 | self.alive.set()
52 | self.hilo.start()
53 |
54 | def stop_hilo(self):
55 | if(self.hilo is not None):
56 | self.alive.clear()
57 | self.hilo.join()
58 | self.hilo = None
59 |
--------------------------------------------------------------------------------
/ProgressBarCircular con ardino/diagrama_conexión.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MagnoEfren/PyQt5/191e03360d1550ddd331451b6cf9e78831eec43d/ProgressBarCircular con ardino/diagrama_conexión.png
--------------------------------------------------------------------------------
/ProgressBarCircular con ardino/main.py:
--------------------------------------------------------------------------------
1 | # ProgressBar Circular Arduino y PyQt5
2 | # @autor: Magno Efren
3 | # Youtube: https://www.youtube.com/c/MagnoEfren
4 | import sys
5 | from ui_progressBarCircular import *
6 | from comunicacion_serial import Comunicacion
7 | from PyQt5.QtCore import QTimer
8 |
9 | class MiApp(QtWidgets.QMainWindow):
10 | def __init__(self,*args, **kwargs):
11 | super().__init__()
12 | self.ui = Ui_MainWindow()
13 | self.ui.setupUi(self)
14 |
15 | self.serial = Comunicacion()
16 | self.puertos_disponible()
17 | self.nivel = 0.0
18 |
19 | self.serial.datos_recibidos.connect(self.datos_arduino)
20 | self.ui.velocidad.addItems(self.serial.baudrates)
21 | self.ui.velocidad.setCurrentText("9600")
22 |
23 | self.ui.conectar.clicked.connect(self.conectar)
24 | self.ui.actualizar.clicked.connect(self.mostrar_barra)
25 | self.ui.desconectar.clicked.connect(self.desconectar)
26 |
27 | def datos_arduino(self, data):
28 | self.nivel = float(data)
29 |
30 | def conectar(self):
31 | port = self.ui.puertos.currentText()
32 | baud = self.ui.velocidad.currentText()
33 | self.serial.arduino.port = port
34 | self.serial.arduino.baudrate = baud
35 | self.serial.conexion_serial()
36 |
37 | def desconectar(self):
38 | self.serial.desconectar()
39 |
40 | def mostrar_barra(self):
41 | self.progressbar()
42 | QTimer.singleShot(20, self.mostrar_barra)
43 |
44 | def puertos_disponible(self):
45 | self.serial.puertos_disponibles()
46 | self.ui.puertos.clear()
47 | self.ui.puertos.addItems(self.serial.puertos)
48 |
49 | def progressbar(self):
50 | estilo = """ QFrame{
51 | border-radius: 150px;
52 | background-color: qconicalgradient(cx:0.5, cy:0.5, angle:90, stop:{stop1}
53 | rgba(255, 0, 55, 255), stop:{stop2} rgba(255, 0, 0, 30));
54 | }"""
55 | val = (self.nivel)/4.91
56 | stop1 = str(abs(val - 0.001))
57 | stop2 = str(val)
58 | valor1 = int(float(stop1)*1000)
59 | valor2 = int(float(stop2)*1000)
60 | if (valor1>=0 and valor2<=1000) and (valor2>=0 and valor1<=1000):
61 | nuevo_estilo = estilo.replace('{stop1}', stop1).replace('{stop2}', stop2)
62 | self.ui.voltaje.setText(str(self.nivel))
63 | self.ui.progressbar.setStyleSheet(nuevo_estilo)
64 | if __name__ == "__main__":
65 | app = QtWidgets.QApplication(sys.argv)
66 | mi_app = MiApp()
67 | mi_app.show()
68 | sys.exit(app.exec_())
69 |
--------------------------------------------------------------------------------
/ProgressBarCircular con ardino/ui_progressBarCircular.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'progressBarCircular.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.15.4
6 | #
7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is
8 | # run again. Do not edit this file unless you know what you are doing.
9 |
10 |
11 | from PyQt5 import QtCore, QtGui, QtWidgets
12 |
13 |
14 | class Ui_MainWindow(object):
15 | def setupUi(self, MainWindow):
16 | MainWindow.setObjectName("MainWindow")
17 | MainWindow.resize(528, 459)
18 | self.centralwidget = QtWidgets.QWidget(MainWindow)
19 | self.centralwidget.setObjectName("centralwidget")
20 | self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
21 | self.verticalLayout.setContentsMargins(0, 0, 0, 0)
22 | self.verticalLayout.setSpacing(0)
23 | self.verticalLayout.setObjectName("verticalLayout")
24 | self.frame = QtWidgets.QFrame(self.centralwidget)
25 | self.frame.setStyleSheet("background-color: rgb(213, 213, 213);")
26 | self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
27 | self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
28 | self.frame.setObjectName("frame")
29 | self.progressbar = QtWidgets.QFrame(self.frame)
30 | self.progressbar.setGeometry(QtCore.QRect(110, 60, 300, 300))
31 | self.progressbar.setMinimumSize(QtCore.QSize(300, 300))
32 | self.progressbar.setStyleSheet("QFrame{\n"
33 | "border-radius: 150px;\n"
34 | "background-color: qconicalgradient(cx:0.5, cy:0.5, angle:90, stop: {stop1} rgba(255, 0, 0, 0), stop:{stop2} rgba(255, 0, 95, 255));\n"
35 | "\n"
36 | "\n"
37 | "\n"
38 | "}")
39 | self.progressbar.setFrameShape(QtWidgets.QFrame.StyledPanel)
40 | self.progressbar.setFrameShadow(QtWidgets.QFrame.Raised)
41 | self.progressbar.setObjectName("progressbar")
42 | self.circulo = QtWidgets.QFrame(self.progressbar)
43 | self.circulo.setGeometry(QtCore.QRect(20, 20, 260, 260))
44 | self.circulo.setMinimumSize(QtCore.QSize(260, 260))
45 | self.circulo.setStyleSheet("QFrame{\n"
46 | " \n"
47 | " background-color: rgb(0, 0, 255);\n"
48 | " border-radius: 130px;\n"
49 | "\n"
50 | "\n"
51 | "}")
52 | self.circulo.setFrameShape(QtWidgets.QFrame.StyledPanel)
53 | self.circulo.setFrameShadow(QtWidgets.QFrame.Raised)
54 | self.circulo.setObjectName("circulo")
55 | self.voltaje = QtWidgets.QLabel(self.circulo)
56 | self.voltaje.setGeometry(QtCore.QRect(51, 100, 111, 68))
57 | self.voltaje.setStyleSheet("font: 85 36pt \"Arial \";\n"
58 | "color: rgb(255, 255, 255);")
59 | self.voltaje.setAlignment(QtCore.Qt.AlignCenter)
60 | self.voltaje.setObjectName("voltaje")
61 | self.label_2 = QtWidgets.QLabel(self.circulo)
62 | self.label_2.setGeometry(QtCore.QRect(170, 100, 37, 68))
63 | self.label_2.setStyleSheet("font: 85 36pt \"Arial \";\n"
64 | "color: rgb(255, 255, 255);")
65 | self.label_2.setAlignment(QtCore.Qt.AlignCenter)
66 | self.label_2.setObjectName("label_2")
67 | self.label = QtWidgets.QLabel(self.circulo)
68 | self.label.setGeometry(QtCore.QRect(60, 190, 141, 20))
69 | self.label.setStyleSheet("font: 63 12pt \"Segoe UI Semibold\";\n"
70 | "color: rgb(255, 255, 255);")
71 | self.label.setAlignment(QtCore.Qt.AlignCenter)
72 | self.label.setObjectName("label")
73 | self.actualizar = QtWidgets.QPushButton(self.frame)
74 | self.actualizar.setGeometry(QtCore.QRect(220, 30, 75, 23))
75 | self.actualizar.setStyleSheet("QPushButton{\n"
76 | "border:3px solid rgb(0, 0, 255);\n"
77 | "font: 87 9pt \"Arial Black\";\n"
78 | "}\n"
79 | "\n"
80 | "QPushButton:hover{\n"
81 | "border:3px solid rgb(255, 0, 0);\n"
82 | "font: 87 9pt \"Arial Black\";\n"
83 | "}\n"
84 | "")
85 | self.actualizar.setObjectName("actualizar")
86 | self.layoutWidget = QtWidgets.QWidget(self.frame)
87 | self.layoutWidget.setGeometry(QtCore.QRect(20, 390, 511, 28))
88 | self.layoutWidget.setObjectName("layoutWidget")
89 | self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget)
90 | self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
91 | self.horizontalLayout.setObjectName("horizontalLayout")
92 | self.desconectar = QtWidgets.QPushButton(self.layoutWidget)
93 | self.desconectar.setStyleSheet("background-color: rgb(170, 0, 255);\n"
94 | "font: 87 9pt \"Arial Black\";")
95 | self.desconectar.setObjectName("desconectar")
96 | self.horizontalLayout.addWidget(self.desconectar)
97 | self.conectar = QtWidgets.QPushButton(self.layoutWidget)
98 | self.conectar.setStyleSheet("background-color: rgb(0, 170, 0);\n"
99 | "font: 87 9pt \"Arial Black\";")
100 | self.conectar.setObjectName("conectar")
101 | self.horizontalLayout.addWidget(self.conectar)
102 | self.puertos = QtWidgets.QComboBox(self.layoutWidget)
103 | self.puertos.setObjectName("puertos")
104 | self.horizontalLayout.addWidget(self.puertos)
105 | self.velocidad = QtWidgets.QComboBox(self.layoutWidget)
106 | self.velocidad.setObjectName("velocidad")
107 | self.horizontalLayout.addWidget(self.velocidad)
108 | self.verticalLayout.addWidget(self.frame)
109 | MainWindow.setCentralWidget(self.centralwidget)
110 |
111 | self.retranslateUi(MainWindow)
112 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
113 |
114 | def retranslateUi(self, MainWindow):
115 | _translate = QtCore.QCoreApplication.translate
116 | MainWindow.setWindowTitle(_translate("MainWindow", "ProgressBarCircular con Arduino"))
117 | self.voltaje.setText(_translate("MainWindow", "5.0"))
118 | self.label_2.setText(_translate("MainWindow", "V"))
119 | self.label.setText(_translate("MainWindow", "VOLTAJE ARDUINO"))
120 | self.actualizar.setText(_translate("MainWindow", "Iniciar"))
121 | self.desconectar.setText(_translate("MainWindow", "DESCONECTAR"))
122 | self.conectar.setText(_translate("MainWindow", "CONECTAR"))
123 |
124 |
125 | if __name__ == "__main__":
126 | import sys
127 | app = QtWidgets.QApplication(sys.argv)
128 | MainWindow = QtWidgets.QMainWindow()
129 | ui = Ui_MainWindow()
130 | ui.setupUi(MainWindow)
131 | MainWindow.show()
132 | sys.exit(app.exec_())
133 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GUI en Python con PyQt5
2 |
3 |