我在此代码中有此代码,我已进行了自定义设计,但是当我尝试更改图标时,它并没有更改 将tkinter导入为tk 将tkinter.ttk导入为ttk 从ctypes导入windll
GWL_EXSTYLE=-20
WS_EX_APPWINDOW=0x00040000
WS_EX_TOOLWINDOW=0x00000080
def set_appwindow(root):
hwnd = windll.user32.GetParent(root.winfo_id())
style = windll.user32.GetWindowLongW(hwnd, GWL_EXSTYLE)
style = style & ~WS_EX_TOOLWINDOW
style = style | WS_EX_APPWINDOW
res = windll.user32.SetWindowLongW(hwnd, GWL_EXSTYLE, style)
# re-assert the new window style
root.wm_withdraw()
root.after(10, lambda: root.wm_deiconify())
def main():
root = tk.Tk()
root.wm_title("AppWindow Test")
button = ttk.Button(root, text='Exit', command=lambda: root.destroy())
button.place(x=10,y=10)
root.overrideredirect(True)
root.after(10, lambda: set_appwindow(root))
root.mainloop()
if __name__ == '__main__':
main()
答案 0 :(得分:0)
您可以使用以下命令更改窗口图标
variables:
- group: 'my-variable-group'
- name: myfirstadditionalvariable
value: 100
- name: myconditionalvariable
${{ if eq( variables['Build.SourceBranchName'], 'master' ) }}:
value: masterBranchValue
${{ if ne( variables['Build.SourceBranchName'], 'master' ) }}:
value: featureBranchValue
=======