Tk Source Code

View Ticket
Login
Ticket UUID: f436621c1aefafee863920db005d551ee6430b10
Title: tk_getSaveFile: -defaultextension should work on windows as it does on unix, wrt adding a suffix
Type: Bug Version: 8.6.9
Submitter: pointsman Created on: 2019-08-07 12:37:21
Subsystem: 37. [tk_get*File] Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2026-08-05 17:51:19
Resolution: None Closed By: nobody
    Closed on:
Description:
If tk_getSaveFile is used on unix with a -filetype list and the user types in a file name without a suffix, a suffix will be added to the returned name according to the file type, the user has choosen in the dialog.

On windows, this does not happen (although it is expected behaviour, most windows applications will add a suffix in this case). The programmer need plattform specific work-around code, looking at the value of the with -typevariable argument provided variable and if the returned file name has already a suffix and add one, if it hasn't.

While the behaviour is correctly documented it would be better, if tk_getSaveFile would behave the same on unix and windows.

Since this is a behaviour change this is probably something for 9.0
User Comments: anonymous added on 2026-08-05 17:51:19:
As mentioned in #2045553, setting defaultextension to "" explicitely should disable this appending behaviour, so that it is possible to create files without extension.

Changing that "sentinel" value to something else is OK, but it should be possible to create files without extension, not by default.