Gar*_*ess 1 python user-interface tkinter button pysimplegui
我正在使用 PySimpleGui 制作一个 GUI,我希望我的一个按钮是一个圆圈,一个更大。有没有办法做到这一点?如果是这样,怎么办?我正在使用 TKinter 端口。
尝试使用image_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()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5686 次 |
| 最近记录: |