python tkinter窗口边缘直角或圆角


本文由 简悦 SimpRead 转码, 原文地址 blog.csdn.net

代码:

def WinGUI_Rounded_right_angles(window,V=0):#窗口边缘 1:直角 0:圆角
    _, empty_icon_path = tempfile.mkstemp()
    window.iconbitmap(empty_icon_path)
    DwmApi = ctypes.windll.dwmapi
    DwmSetWindowAttribute = DwmApi.DwmSetWindowAttribute
    _master = win32gui.GetParent(window.winfo_id())
    Value = ctypes.c_int(V)
    def dwm_set_window_attribute(type, attribute, size):
        DwmSetWindowAttribute(_master,type,attribute,size)
    dwm_set_window_attribute(33,ctypes.byref(Value),ctypes.sizeof(Value))

测试:

#直角
a=tk1.Window()
WinGUI_Rounded_right_angles(a,1)
a.mainloop()

#圆角
a=tk1.Window()
WinGUI_Rounded_right_angles(a,0)
a.mainloop()

 

 点个赞吧

声明:HEUE NOTE|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA 4.0协议进行授权

转载:转载请注明原文链接 - python tkinter窗口边缘直角或圆角