Subido por Julio Cesar Vidal

vertices curvos

Anuncio
from PyQt5.QtGui import QIcon, QPainterPath, QRegion, QPainter
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtCore import Qt, QRectF
import sys
# Resto del código...
class Menu(QWidget):
def __init__(self):
super(Menu, self).__init__()
self.inicio()
def inicio(self):
self.setGeometry(800, 100, 540, 840)
def paintEvent(self, event):
try:
painter = QPainter(self)
painter.setRenderHint(QPainter.Antialiasing) # Activa el suavizado de bordes
path = QPainterPath()
rectf = QRectF(self.rect()) # Convertimos el QRect a QRectF
path.addRoundedRect(rectf, 30, 30) # Ajusta estos valores para controlar el radio de las esquinas
region = QRegion(path.toFillPolygon().toPolygon())
self.setMask(region)
except Exception as e:
print("Error en paintEvent:", str(e))
if __name__ == '__main__':
app = QApplication(sys.argv)
window = Menu()
window.show()
sys.exit(app.exec_())
Descargar