# OPCIÓN 1: PySide6 (RECOMENDADA) # pip install PySide6 import sys from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QPushButton, QHBoxLayout from PySide6.QtWebEngineWidgets import QWebEngineView from PySide6.QtCore import QUrl class MathJaxPySide6(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("🧮 MathJax con PySide6") self.setGeometry(100, 100, 1200, 800) # Widget central central_widget = QWidget() self.setCentralWidget(central_widget) # Layout principal layout = QVBoxLayout(central_widget) # Botones de control button_layout = QHBoxLayout() btn_reload = QPushButton("🔄 Recargar") btn_zoom_in = QPushButton("🔍+ Zoom In") btn_zoom_out = QPushButton("🔍- Zoom Out") btn_fullscreen = QPushButton("📺 Pantalla Completa") btn_reload.clicked.connect(self.reload_page) btn_zoom_in.clicked.connect(self.zoom_in) btn_zoom_out.clicked.connect(self.zoom_out) btn_fullscreen.clicked.connect(self.toggle_fullscreen) button_layout.addWidget(btn_reload) button_layout.addWidget(btn_zoom_in) button_layout.addWidget(btn_zoom_out) button_layout.addWidget(btn_fullscreen) button_layout.addStretch() layout.addLayout(button_layout) # Vista web self.web_view = QWebEngineView() layout.addWidget(self.web_view) # HTML con MathJax avanzado self.html_content = """ MathJax Avanzado

🚀 Laboratorio Matemático Avanzado

📊 Álgebra Lineal

Determinante de matriz 3×3:

$$\\det(A) = \\begin{vmatrix} a_{11} & a_{12} & a_{13} \\\\ a_{21} & a_{22} & a_{23} \\\\ a_{31} & a_{32} & a_{33} \\end{vmatrix}$$

Eigenvalores: $\\det(A - \\lambda I) = 0$

⚛️ Física Cuántica

Operador Hamiltoniano:

$$\\hat{H} = \\frac{-\\hbar^2}{2m}\\nabla^2 + V(\\mathbf{r})$$

Función de onda normalizada:

$$\\int_{-\\infty}^{\\infty} |\\Psi(x,t)|^2 dx = 1$$

🔬 Matemáticas Avanzadas

Transformada de Fourier:

$$\\mathcal{F}[f(t)] = \\int_{-\\infty}^{\\infty} f(t) e^{-2\\pi i \\xi t} dt$$

Función Gamma:

$$\\Gamma(z) = \\int_0^\\infty t^{z-1} e^{-t} dt$$

🎮 Generador Interactivo

""" # Cargar contenido self.web_view.setHtml(self.html_content) def reload_page(self): self.web_view.setHtml(self.html_content) def zoom_in(self): current_zoom = self.web_view.zoomFactor() self.web_view.setZoomFactor(current_zoom * 1.2) def zoom_out(self): current_zoom = self.web_view.zoomFactor() self.web_view.setZoomFactor(current_zoom / 1.2) def toggle_fullscreen(self): if self.isFullScreen(): self.showNormal() else: self.showFullScreen() # OPCIÓN 2: PyQt6 (Alternativa) # pip install PyQt6 PyQt6-WebEngine """ import sys from PyQt6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget from PyQt6.QtWebEngineWidgets import QWebEngineView class MathJaxPyQt6(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("MathJax con PyQt6") self.setGeometry(100, 100, 1000, 700) central_widget = QWidget() self.setCentralWidget(central_widget) layout = QVBoxLayout(central_widget) self.web_view = QWebEngineView() layout.addWidget(self.web_view) # Mismo HTML que PySide6 html_content = "[MISMO HTML DE ARRIBA]" self.web_view.setHtml(html_content) def run_pyqt6(): app = QApplication(sys.argv) window = MathJaxPyQt6() window.show() sys.exit(app.exec()) """ def run_pyside6(): app = QApplication(sys.argv) window = MathJaxPySide6() window.show() sys.exit(app.exec()) if __name__ == "__main__": print("🧮 Iniciando aplicación MathJax con PySide6...") print("✨ Funciones disponibles:") print(" - Zoom in/out") print(" - Pantalla completa") print(" - Generador interactivo de ecuaciones") print(" - MathJax completamente funcional") run_pyside6() # RESUMEN DE INSTALACIÓN: # # Para PySide6 (RECOMENDADO): # pip install PySide6 # # Para PyQt6: # pip install PyQt6 PyQt6-WebEngine # # Ambos funcionan igual de bien para MathJax, # pero PySide6 tiene licencia más permisiva.