Message247895
Minor nit: you import 'ttkcompat' and add 'compat'.
On to the new 'compat': the only doc for .setup_master is the docstring
"If master is not None, itself is returned. If master is None,
the default master is returned if there is one, otherwise a new
master is created and returned."
So if master is always passed in, it seems that the call does nothing and could be removed.
._load_tile and ._tile_loaded have no doc. As near as I can tell from
>>> r = tk.Tk()
>>> s = ttk.Scrollbar(r) # does not set ._tile_loaded on r
>>> ttk._load_tile(r) # ditto, None returned
with 8.5, ._load_tile does nothing and ._tile_loaded is never set. They are only used for 8.4. Correct? If the tile extension is loaded, then use_ttk would be set to True. Is the tile extension fully compatible with using ttk?
I would like compat.py to consist of an initialization functions that is called exactly once, always with a Tk(), to set globals in the module.
import tkinter as tk
from tkinter import ttk
def initialize(master, ttk_wanted=True): # untested
globals use_ttk, Scrollbar, ...
if not ttk_wanted:
use_ttk = False
else:
try:
ttk._load_tile(master)
except tkinter.TclError:
use_ttk = False
else:
use_ttk = True
if use_ttk:
from ttk import Scrollbar, ...
else:
from tk import Scroolbar, ...
Initialize would normally be called when Idle starts up. ttk.wanted could make use_ttk a user option. Initialize with ttk_wanted True/False would be used for testing. |
|
Date |
User |
Action |
Args |
2015-08-02 20:59:43 | terry.reedy | set | recipients:
+ terry.reedy, rhettinger, kbk, ncoghlan, ned.deily, roger.serwy, markroseman, serhiy.storchaka |
2015-08-02 20:59:43 | terry.reedy | set | messageid: <1438549183.32.0.614941859897.issue24750@psf.upfronthosting.co.za> |
2015-08-02 20:59:43 | terry.reedy | link | issue24750 messages |
2015-08-02 20:59:43 | terry.reedy | create | |
|