You will get that warning even when referencing Tk/Tcl 8.6.12 in Python3 v3.12. If this is a command-line application, simply redirect its stderr to /dev/null (e.g. 2> /dev/null).
#!/usr/bin/env python3
import os
import sys
try:
import Tkinter as tk # Python 2
except ImportError:
import tkinter as tk # Python 3
def main():
# same as 2> /dev/null in the shell
f = open("/dev/null", "w")
os.dup2(f.fileno(), 2)
f.close()
print("Tcl Version: {}".format(tk.Tcl().eval('info patchlevel')))
print("Tk Version: {}".format(tk.Tk().eval('info patchlevel')))
if __name__ == '__main__':
sys.exit(main())
Without those first three lines under main(), I get this output when run from the command-line in macOS Sonoma 14.1.1:
Tcl Version: 8.6.12
2023-11-24 12:09:24.253 Python[4114:134228] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
Tk Version: 8.6.12
and after redirecting stderr (2):
Tcl Version: 8.6.12
Tk Version: 8.6.12
This is not specifically a Tk/Tcl issue as I have Python3 apps using PySide Qt 6.5 that cause that warning too until I gag stderr as I have done above.