亲爱的,
如何使用Python/PySimpleGUI最小化窗口?知道了这一点,我想隐藏现有的标题栏从我的窗口,并添加我的个人图标:最大化,最小化和关闭,它是对2,而不是情况下最小化。
我遵循了共享的答案:How to create a minimize button with pysimplegui?,不幸的是没有帮助,它的行为与关闭按钮一样。
if event == "Button":
window.close()请你支持一下好吗?
发布于 2022-11-09 12:27:55
随时检查https://www.pysimplegui.org/en/latest/上的文档。
import PySimpleGUI as sg
sg.PySimpleGUI.SYMBOL_TITLEBAR_MINIMIZE = '.'
sg.PySimpleGUI.SYMBOL_TITLEBAR_MAXIMIZE = 'O'
sg.PySimpleGUI.SYMBOL_TITLEBAR_CLOSE = 'x'
layout = [
[sg.Titlebar(
title='TITLE',
icon=sg.EMOJI_BASE64_HAPPY_IDEA,
text_color='white',
background_color='blue',
font=('Courier New', 40, 'bold'),
)],
[sg.Button('Minimize'), sg.Button('Exit')],
]
window = sg.Window('Title', layout, finalize=True,
# use_custom_titlebar=True,
# titlebar_background_color='blue',
# titlebar_text_color='white',
# titlebar_font=('Courier New', 40, 'bold'),
# titlebar_icon=sg.EMOJI_BASE64_HAPPY_IDEA,
)
while True:
event, values = window.read()
if event in (sg.WIN_CLOSED, 'Exit'):
break
elif event == 'Minimize':
window.minimize()
window.close()窗口的minimize、maximize和close按钮的按钮被定义为Text元素。如果要为Titlebar元素使用数字,则必须自己定义它们。
https://stackoverflow.com/questions/74373098
复制相似问题