marticliment / win32mica

Win32mica: a simple module to add the Mica effect on legacy python windows.
https://pypi.org/project/win32mica
MIT License
95 stars 5 forks source link

Everything works but the I cannot close the thing after restoring a minimised window #11

Closed SlavBoi420 closed 1 year ago

SlavBoi420 commented 1 year ago

I made a tkinter application which uses this beautiful mica style, and everything worked. The mica applies fine, there are no errors related to HWND, but there is this one issue. When I restore a minimised window, there are no hitboxes for any buttons on the titlebar. This isssue is related to #7 where OP was not able to focus his window. The same thing happens here, but the only clickable buttons are the ones I made by myself in python, the close, maximise and minimise buttons don't really work

From #7 , I found out that this issue was a tkinter one, is it the case here too?

yes

From this gif, I was trying to click the minimise button again, but the click is registered on the desktop instead of the app itself

marticliment commented 1 year ago

Possibly. I have never experienced this issue with Qt.

Could you please share your code so I can test it?

sumeshir26 commented 1 year ago

This is a tkinter bug which happens whenever you use the -transperentcolor attribute.This can be fixed by minimizing and maximizing the application from your code manuallay after applying the mica.

SlavBoi420 commented 1 year ago

Thanks for your reply @sumeshir26 but this is the issue I have. The app works fine if I just open it like that (the titlebar buttons work), but as you can see in the gif, after minimising, the buttons fail to respond.

Edit 1: I actually tried the example code given here, which looks like this:

import tkinter as tk
from ctypes import windll
try:
    import win32mica as mc
except ImportError:
    import os
    os.system("pip install win32mica")

app=tk.Tk()
app.title("Tk Dark")
app.configure(bg="#000000")
app.wm_attributes("-transparent", "#000000")
app.update()
HWND=windll.user32.GetParent(app.winfo_id())
mc.ApplyMica(HWND, ColorMode=mc.MICAMODE.DARK)

tk.mainloop()

And both the clickthrough and the minimising problem still exists here (I think it is a tkinter bug in that case)

Edit 2: I ran the code again, this time, maximising it (as I didn't specify if the window has to be resizable or not), and the problem still exists. The code becomes entirely clickthrough, even the titlebar

marticliment commented 1 year ago

Then it is a tkinter bug, and much can't be done about it. It is the same as #7

SlavBoi420 commented 1 year ago

Alright, thanks for clearing up this doubt :)