Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The window can not be clicked through (tkinter wm_attributes("-transparentcolor", color) method) #5624

Closed
astqx opened this issue Mar 11, 2021 · 6 comments · Fixed by #5625
Closed

Comments

@astqx
Copy link

astqx commented Mar 11, 2021

Description of the issue

When using the tkinter module's method wm_attributes("-transparentcolor", color), the specified color will be treated as transparent (the region of the window containing the color can be clicked through). If the script is run normally / packaged using the --onedir mode of pyinstaller, the behaviour is as expected but, if --onefile mode is used, click-through does not work in the resulting exe.

Context information (for bug reports)

  • Output of pyinstaller --version: 4.1
  • Version of Python: 3.8
  • Platform: Windows

A minimal example program which shows the error

from tkinter import *

def focus(event):
	print(event)

root=Tk()
root.config(bg='blue')
root.wm_attributes('-transparentcolor',root['bg'])
root.attributes('-topmost',True)

root.bind('<FocusIn>',focus)
root.bind('<FocusOut>',focus)

root.mainloop()
@rokm
Copy link
Member

rokm commented Mar 11, 2021

Can you try with PyInstaller 4.2?

Click-through indeed does not seem to be working in onefile with 4.1, but it seems to work with 4.2. According to git bisect, 3c3228d was the commit that fixed it.

@astqx
Copy link
Author

astqx commented Mar 11, 2021

I don't exactly see how linked commit fixed this, but the click-though does work with 4.2. Thank you and sorry to have wasted your time.

@bwoodsend
Copy link
Member

bwoodsend commented Mar 11, 2021

That is very weird. Does adding an icon break it again by any chance?

@astqx
Copy link
Author

astqx commented Mar 11, 2021

Just tested, adding an icon does not break it, using --icon=NONE does, click-through did not work.

@rokm
Copy link
Member

rokm commented Mar 11, 2021

Just tested, adding an icon does not break it, using --icon=NONE does, click-through did not work.

Hmm, that is indeed the case, and a very useful hint.

@rokm rokm added the bug label Mar 11, 2021
rokm added a commit to rokm/pyinstaller that referenced this issue Mar 11, 2021
The onefile builds on Windows may not have manifest embedded if
icon was explicitly disabled via `--icon NONE`. This in turn causes
subtle issues, such as pyinstaller#5624.
rokm added a commit to rokm/pyinstaller that referenced this issue Mar 11, 2021
The onefile builds on Windows may not have manifest embedded if
icon was explicitly disabled via `--icon NONE`. This in turn causes
subtle issues, such as pyinstaller#5624.
@rokm
Copy link
Member

rokm commented Mar 11, 2021

And as is often the case around here, the problem was lying somewhere else, but was triggered by icon being disabled. Or, prior to 3c3228d, by not being specified.

rokm added a commit to rokm/pyinstaller that referenced this issue Mar 11, 2021
The onefile builds on Windows may not have manifest embedded if
icon was explicitly disabled via `--icon NONE`. This in turn causes
subtle issues, such as pyinstaller#5624.

Remove the convoluted check for entering the resource-modification
codepath, as we always need to reach the part that embeds the
manifest in the onefile executable, and the rest of
resource-modification parts are already guarded by their corresponding
checks. This should simplify the code and make it less prone to
errors.
pull bot pushed a commit to kp-forks/pyinstaller that referenced this issue Mar 12, 2021
The onefile builds on Windows may not have manifest embedded if
icon was explicitly disabled via `--icon NONE`. This in turn causes
subtle issues, such as pyinstaller#5624.

Remove the convoluted check for entering the resource-modification
codepath, as we always need to reach the part that embeds the
manifest in the onefile executable, and the rest of
resource-modification parts are already guarded by their corresponding
checks. This should simplify the code and make it less prone to
errors.
Legorooj pushed a commit that referenced this issue Mar 13, 2021
#5625)

* tests: add test for onefile builds on Windows having a manifest

Test building with different --icon options, as that is what seems to
be triggering inconsistent behavior at the moment.

* building: ensure that onefile builds on Windows have manifest embedded

The onefile builds on Windows may not have manifest embedded if
icon was explicitly disabled via `--icon NONE`. This in turn causes
subtle issues, such as #5624.

Remove the convoluted check for entering the resource-modification
codepath, as we always need to reach the part that embeds the
manifest in the onefile executable, and the rest of
resource-modification parts are already guarded by their corresponding
checks. This should simplify the code and make it less prone to
errors.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants