This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Pat Thoyts
Recipients Pat Thoyts, [HYBRID BEING], paul.moore, serhiy.storchaka, steve.dower, terry.reedy, tim.golden, zach.ware
Date 2016-06-20.12:18:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1466425126.17.0.338103368481.issue27309@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-06-20 12:18:46Pat Thoytssetrecipients: + Pat Thoyts, terry.reedy, paul.moore, tim.golden, zach.ware, serhiy.storchaka, steve.dower, [HYBRID BEING]
2016-06-20 12:18:46Pat Thoytssetmessageid: <1466425126.17.0.338103368481.issue27309@psf.upfronthosting.co.za>
2016-06-20 12:18:46Pat Thoytslinkissue27309 messages
2016-06-20 12:18:45Pat Thoytscreate