Pat Thoyts added the comment:

As explained in the SO answer, in Tk on Windows the messagebox, file open 
dialog, save as dialog and in 8.6 up the font dialog are all system standard 
dialogs. Tk gets Windows to show the common dialog or messagebox and just wraps 
the Win32 API calls. As a result these dialogs are not themed using ttk as the 
various elements are not Tk controls at all.

The theming control is therefore provided by Windows and is controlled at an 
application level by the use of an RT_MANIFST resource. This contains various 
chunk of XML and one of these is used to declare that theming may be applied by 
the Visual Styles API. The Tk executables include this bit of manifest but the 
python exe does not.

You can test this out using the attached python.exe.manifest file. To allow 
this to work you have to remove the existing RT_MANIFEST resource from the 
python executable as an embedded resource overrides a sibling manifest file. I 
find the easiest way to work with this is to open the exe in Visual Studio and 
use the resources view to change the resource in place. You can copy the 
contents of the manifest file over the existing RT_MANIFEST resource or you can 
remove the embedded resource and let the system pick up the python.exe.manifest 
file from the same folder as python.exe.

This is not dependent on Tk version. All versions of Tk since around 8.0 have 
delegated to the Win32 MessageBox and GetOpenFileName API calls. With the 
introduction of Window XP and the Visual Styles API Microsoft added this 
requirement to declare support for theming via manifests. So if you have the 
right manifest and theming is enabled on your system then Tk 8.4 and 8.3 will 
all show themed common dialogs and messageboxes.

This does not affect OS X or X Windows. On X Windows Tk provides all these 
dialogs itself and so they use Tk widgets (or ttk widgets in more recent 
versions). On OS X I believe the messagebox and common dialogs are all system 
provided but it will have its own system for controlling that.

In short, python needs to merge it this manifest with the manifest being put in 
place already. The Visual Studio 'mt' tool can do that if you want to merge 
manifests.

----------
nosy: +Pat Thoyts
Added file: http://bugs.python.org/file43487/python.exe.manifest

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27309>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to