我正在用 PySimpleGui 制作一個 GUI,我希望我的一個按鈕是一個圓圈,一個更大。有沒有辦法做到這一點?如果是這樣,如何?我正在使用 TKinter 埠。
uj5u.com熱心網友回復:
嘗試 optionimage_filename或image_dataof sg.Button,并從主題設定中設定正確的按鈕顏色,還將邊框寬度設定為 0。
這是它如何作業的示例,請記住在以下代碼中使用您的影像檔案。
import PySimpleGUI as sg
font = ('Helvetica', 12, 'bold italic')
sg.theme('Dark')
sg.set_options(font=font)
colors = (sg.theme_background_color(), sg.theme_background_color())
layout = [
[sg.Button('Blue\nCircle', button_color=colors, image_filename='d:/circle_blue.png', border_width=0)]
]
window = sg.Window('Image Button', layout, finalize=True)
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
break
window.close()

轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/388695.html
標籤:Python 用户界面 特金特 按钮 pysimplegui
