Skip to content

ttkwidgets.Table error .... according to example code #100

@russ-hensel

Description

@russ-hensel

I have been poking around with the table example code:

ttkwidgets/example_table.py at master · TkinterEP/ttkwidgets
https://github.com/TkinterEP/ttkwidgets/blob/master/examples/example_table.py

And cannot get past the error:

Python 3.7.13 (default, Mar 28 2022, 08:03:21) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.31.1 -- An enhanced Interactive Python.

runfile('D:/Russ/0000/python00/python3/_projects/clipboard/untitled2.py', wdir='D:/Russ/0000/python00/python3/_projects/clipboard')
_format_mapdict {}
_format_mapdict {'foreground': [('disabled', '#a3a3a3'), ('!disabled', '!selected', 'black'), ('selected', '#ffffff'), ('disabled', 'gray40')], 'background': ['disabled', '#d9d9d9', '!disabled !selected', '#ffffff', 'selected', '#4a6984', ('disabled', '#E6E6E6')], 'fieldbackground': [('disabled', '#E6E6E6')]}
Traceback (most recent call last):

File "D:\Russ\0000\python00\python3_projects\clipboard\untitled2.py", line 30, in
drag_rows=drag_row.get(), height=6)

File "C:\apps\Anaconda3\envs\all_exp\lib\site-packages\ttkwidgets\table.py", line 64, in init
self._initialize_style()

File "C:\apps\Anaconda3\envs\all_exp\lib\site-packages\ttkwidgets\table.py", line 118, in _initialize_style
style.map('Table', **style_map)

File "C:\apps\Anaconda3\envs\all_exp\lib\tkinter\ttk.py", line 405, in map
self.tk.call(self._name, "map", style, *_format_mapdict(kw)),

TclError: Invalid state name d

Added line to def _mapdict_values(items):
print( f"_format_mapdict {mapdict}")

_format_mapdict {}

and debugger shows:

!continue
_format_mapdict {'foreground': [('disabled', '#a3a3a3'), ('!disabled', '!selected', 'black'), ('selected', '#ffffff'), ('disabled', 'gray40')], 'background': ['disabled', '#d9d9d9', '!disabled !selected', '#ffffff', 'selected', '#4a6984', ('disabled', '#E6E6E6')], 'fieldbackground': [('disabled', '#E6E6E6')]}

!continue
Traceback (most recent call last):

File "d:\russ\0000\python00\python3_examples\tk\ex_tk_ttkwidgets.py", line 119, in
ex_table()

File "d:\russ\0000\python00\python3_examples\tk\ex_tk_ttkwidgets.py", line 92, in ex_table
height = 6 )

File "C:\apps\Anaconda3\envs\all_exp\lib\site-packages\ttkwidgets\table.py", line 64, in init
self._initialize_style()

File "C:\apps\Anaconda3\envs\all_exp\lib\site-packages\ttkwidgets\table.py", line 118, in _initialize_style
style.map('Table', **style_map)

File "C:\apps\Anaconda3\envs\all_exp\lib\tkinter\ttk.py", line 405, in map
self.tk.call(self._name, "map", style, *_format_mapdict(kw)),

TclError: Invalid state name d

Stepping into this I get:

forground of mapdict
[('disabled', '#a3a3a3'), ('!disabled', '!selected', 'black'), ('selected', '#ffffff'), ('disabled', 'gray40')]

and I get back a "parsed" value for it of:
['d i s a b l e', 'd', '# d 9 d 9 d', '9', '! d i s a b l e d ! s e l e c t e', 'd', '# f f f f f', 'f', 's e l e c t e', 'd', '# 4 a 6 9 8', '4', 'disabled', '#E6E6E6']

which I think causes "TclError: Invalid state name d" I suspect the state name is supposed to be "disabled" ?

That is about as far as I can go. In any case the example appears not to work.

Contact me if you need any other information.

( I have been using your tkCalendar for a long time, thanks. )

Russ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions