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.

classification
Title: Indicating packages to be loaded when a Tcl interpreter is created in tkinter
Type: enhancement Stage: patch review
Components: Tkinter Versions: Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: gpolo, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2009-02-05 20:08 by gpolo, last changed 2022-04-11 14:56 by admin.

Files
File name Uploaded Description Edit
tkdeploader.diff gpolo, 2009-02-05 20:08
ttk_withdeploader.diff gpolo, 2009-02-05 20:09 review
Messages (2)
msg81223 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-02-05 20:08
Hi,

It seems to me that it would be useful to add something to indicate
which packages should be loaded, and how they should be loaded, when a
Tcl interpreter is created through Tkinter.Tk. Right now every extension
has to add some boilerplate code to load a package before starting the
use of extension, and this code tends to be very similar -- like this:

if not required_extension_loaded:
    extlib = os.environ.get('OPTIONAL_VAR_THAT_POINTS_TO_EXT')
    if extlib:
        master.tk.eval('global auto_path; '
                       'lappend auto_path {%s}' % extlib)
    master.tk.call('package', 'require', 'Extlibname')
    required_extension_loaded = True

master is an instance of Tkinter.Tk which has to be created before this,
of course. Some extensions do it in different places in their code, but
tend to involve basically the same code.

The patch attached adds a new module in lib-tk named tkdeploader (not
very nice eh) which handles these "indications". Each dependence to be
loaded can define its own preloader callable, but the module adds a
basic one, named basic_preloader, that should be enough for most
situations. The patch also includes the changes necessary in Tkinter.py,
just two lines.
msg81224 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-02-05 20:09
Attaching patch to show how ttk.py would be with this new module.
History
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49409
2014-10-14 00:51:40terry.reedysetnosy: + serhiy.storchaka
stage: patch review

versions: + Python 3.5, - Python 3.3
2011-06-26 19:03:16terry.reedysettype: enhancement
versions: + Python 3.3, - Python 3.1, Python 2.7
2009-02-05 20:09:49gpolosetfiles: + ttk_withdeploader.diff
messages: + msg81224
2009-02-05 20:08:23gpolocreate