Repository: pyinstaller/pyinstaller

Issue:
The window can not be clicked through (tkinter `wm_attributes("-transparentcolor", color)` method)
## 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

```python
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()
```



Discussion:
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`, 3c3228da89c494f79dc1cead99ab9b4e45a7424e was the commit that fixed it.
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.
That is very weird. Does adding an icon break it again by any chance?
Just tested, adding an icon does not break it, using `--icon=NONE` does, click-through did not work.
> 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.

Resolving patch:
diff --git a/PyInstaller/building/api.py b/PyInstaller/building/api.py
--- a/PyInstaller/building/api.py
+++ b/PyInstaller/building/api.py
@@ -531,8 +531,7 @@ def assemble(self):
         if not os.path.exists(exe):
             raise SystemExit(_MISSING_BOOTLOADER_ERRORMSG)
 
-        if is_win and (self.icon != "NONE" or self.versrsrc or self.resources
-                       or self.uac_admin or self.uac_uiaccess or not is_64bits):
+        if is_win:
             fd, tmpnm = tempfile.mkstemp(prefix=os.path.basename(exe) + ".",
                                          dir=CONF['workpath'])
             # need to close the file, otherwise copying resources will fail
@@ -598,7 +597,7 @@ def assemble(self):
                         logger.error("Error while updating resource %s %s in %s"
                                      " from data file %s",
                                      restype, resname, tmpnm, resfile, exc_info=1)
-            if is_win and self.manifest and not self.exclude_binaries:
+            if self.manifest and not self.exclude_binaries:
                 self.manifest.update_resources(tmpnm, [1])
             trash.append(tmpnm)
             exe = tmpnm


Test patch:
diff --git a/tests/functional/test_basic.py b/tests/functional/test_basic.py
--- a/tests/functional/test_basic.py
+++ b/tests/functional/test_basic.py
@@ -676,3 +676,39 @@ def test_onefile_longpath(pyi_builder, tmpdir):
         assert secret == r'{secret}'
         """.format(data_file=dst_filename, secret=_SECRET),
         ['--add-data', str(add_data_name)])
+
+
+@pytest.mark.win32
+@pytest.mark.parametrize("icon", ["icon_default", "icon_none", "icon_given"])
+def test_onefile_has_manifest(pyi_builder, icon):
+    """
+    Verify that onefile builds on Windows end up having manifest
+    embedded. See issue #5624.
+    """
+    from PyInstaller.utils.win32 import winmanifest
+    from PyInstaller import PACKAGEPATH
+
+    # The test is relevant only for onefile builds
+    if pyi_builder._mode != 'onefile':
+        pytest.skip('The test is relevant only to onefile builds.')
+    # Icon type
+    if icon == 'icon_default':
+        # Default; no --icon argument
+        extra_args = []
+    elif icon == 'icon_none':
+        # Disable icon completely; --icon NONE
+        extra_args = ['--icon', 'NONE']
+    elif icon == 'icon_given':
+        # Locate pyinstaller's default icon, and explicitly give it
+        # via --icon argument
+        icon_path = os.path.join(PACKAGEPATH, 'bootloader', 'images',
+                                 'icon-console.ico')
+        extra_args = ['--icon', icon_path]
+    # Build the executable...
+    pyi_builder.test_source("""print('Hello world!')""", extra_args)
+    # ... and ensure that it contains manifest
+    exes = pyi_builder._find_executables('test_source')
+    assert exes
+    for exe in exes:
+        res = winmanifest.GetManifestResources(exe)
+        assert res, "No manifest resources found!"