# Python Qt 無邊框、圓角視窗 程式碼在這僅提供自己的想法,不一定我的方式是最好的。 讓背景可以是圓框的方式是,直接去修改原本就有的centralwidget 去使用 StyleSheet() 去設定各個角落的弧度。  **程式碼:** ``` def __init__(self): super(Rename, self).__init__() self.init_ui() def init_ui(self): self.ui = Ui_MainWindow() self.ui.setupUi(self) # 設定無邊框 # 設定背景透明 self.setWindowFlags(Qt.FramelessWindowHint) self.setAttribute(Qt.WA_TranslucentBackground) # 設定不透明度 self.setWindowOpacity(0.94) # 透過mainwindow的centralwidget設定圓角邊框 self.center = self.ui.centralwidget self.center.setStyleSheet( """ background-color: #444444; border-top-left-radius:{0}px; border-bottom-left-radius:{0}px; border-top-right-radius:{0}px; border-bottom-right-radius:{0}px; """.format(20) ) ``` **結果如下方:** 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up