[Python] How can I remove **just** the x button (keeping the maximize and minimize buttons)...

Discussão em 'Python' iniciado por Stack, Dezembro 19, 2024.

  1. Stack

    Stack Membro Participativo

    I have this but it removes all buttons. It does allow alt-tabbing unlike overideredirent(True) though:

    hwnd = windll.user32.GetParent(self.root.winfo_id())
    style = windll.user32.GetWindowLongA(hwnd, -16) # GWL_STYLE
    WS_MINIMIZEBOX = 0x20000
    WS_MAXIMIZEBOX = 0x10000
    WS_SYSMENU = 0x80000
    new_style = style | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
    new_style = new_style & ~WS_SYSMENU
    windll.user32.SetWindowLongA(hwnd, -16, new_style)
    self.root.update_idletasks()


    Any ideas?

    Continue reading...

Compartilhe esta Página