命令如下:
border:2px groove gray;border-radius:10px;padding:2px 4px;
应该和CSS很像
测试代码,直接运行就可出效果:
from PyQt5.QtWidgets import (QApplication, QWidget, QPushButton, QHBoxLayout,
QLineEdit)
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import sys
import cv2
def clickHandle():
##main代表按钮的容器widget的对象
button = main.sender()
print(button.objectName())
class my_window(QWidget):
def __init__(self):
super(my_window, self).__init__()
self.button = QPushButton('test', self)
self.button.setStyleSheet('border:2px groove gray;border-radius:10px;padding:2px 4px;')
if __name__ == '__main__':
app = QApplication(sys.argv)
win = my_window()
win.show()
sys.exit(app.exec_())
效果