T
T
Timur Egorov2021-01-10 16:53:45
Python
Timur Egorov, 2021-01-10 16:53:45

How to make border-radius in PyQt5 with multiple corners?

Greetings, I want to do something like this:
5ffb060c7ac4f379401609.png
It turns out like this:
5ffb06312dfe4764664820.png
Here are the lines of code:

self.logo_video = QtWidgets.QToolButton(self.frame)
    self.logo_video.setGeometry(60,50,80,50)
    self.logo_video.setIcon(QtGui.QIcon("img/play.ico"))
    self.logo_video.setIconSize(QtCore.QSize(16, 16))
    self.logo_video.setStyleSheet("background: #363b41; border-radius: 10px")

If I put:
self.logo_video = QtWidgets.QToolButton(self.frame)
    self.logo_video.setGeometry(60,50,80,50)
    self.logo_video.setIcon(QtGui.QIcon("img/play.ico"))
    self.logo_video.setIconSize(QtCore.QSize(16, 16))
    self.logo_video.setStyleSheet("background: #363b41; border-radius: 10px 0 0 10px")

border-radius disappears, how to fix?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2021-01-10
@aimbattttt

I think each one can be customized

border-top-left-radius: 10px
border-top-right-radius: 0
border-bottom-left-radius: 10px
border-bottom-right-radius: 0

T
Timur Egorov, 2021-01-10
@aimbattttt

I solved it like this:

self.logo_video = QtWidgets.QToolButton(self.frame)
    self.logo_video.setGeometry(60,50,80,50)
    self.logo_video.setIcon(QtGui.QIcon("img/play.ico"))
    self.logo_video.setIconSize(QtCore.QSize(16, 16))
    self.logo_video.setStyleSheet("background: #363b41; border-top-left-radius: 10px; border-bottom-left-radius: 10px;")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question