Code Monkey home page Code Monkey logo

Comments (9)

melassa avatar melassa commented on September 23, 2024

I have the same problem under python 3.8, W7 running the table.py example without any change (the example set the 'alt' theme):

Traceback (most recent call last):
   table = Table(root, columns=columns, sortable=sortable.get(), drag_cols=drag_col.get(),
  File "C:\Python38\lib\site-packages\ttkwidgets\table.py", line 68, in __init__
    self._initialize_style()
  File "C:\Python38\lib\site-packages\ttkwidgets\table.py", line 122, in _initialize_style
    style.map('Table', **style_map)
  File "C:\Python38\lib\tkinter\ttk.py", line 403, in map
    self.tk.call(self._name, "map", style, *_format_mapdict(kw)),
_tkinter.TclError: Invalid state name d

from ttkwidgets.

RedFantom avatar RedFantom commented on September 23, 2024

I am unable to reproduce this issue on either Windows 10 with Python 3.9.1 or Windows 7 with Python 3.6.6 or Python 3.8.7. From the code, given the error, I would expect that somehow the style map is not formatted properly (particularly, there's a string where there should be a tuple), but I cannot see how this issue can occur with the style_map.

Is just running the example_table.py from the master branch without any change on a clean Python environment really sufficient to trigger this exception? Because I can't reproduce this exception when doing that...

from ttkwidgets.

melassa avatar melassa commented on September 23, 2024

C:\dev\python\ttkwidgets>py -3 -V
Python 3.8.6

C:\dev\python\ttkwidgets>py -3 -m pip check ttkwidgets
No broken requirements found.

C:\dev\python\ttkwidgets>py -3 examples\example_table.py
Traceback (most recent call last):
  File "examples\example_table.py", line 22, in <module>
    table = Table(root, columns=columns, sortable=sortable.get(), drag_cols=drag_col.get(),
  File "C:\Python38\lib\site-packages\ttkwidgets\table.py", line 68, in __init__
    self._initialize_style()
  File "C:\Python38\lib\site-packages\ttkwidgets\table.py", line 122, in _initialize_style
    style.map('Table', **style_map)
  File "C:\Python38\lib\tkinter\ttk.py", line 403, in map
    self.tk.call(self._name, "map", style, *_format_mapdict(kw)),
_tkinter.TclError: Invalid state name d

ttkwidgets version: 0.11.0

If i comment the line style.theme_use('alt') the program works.

from ttkwidgets.

melassa avatar melassa commented on September 23, 2024

This is the background of alt theme map:

        'background': [
            'disabled', '#d9d9d9', '!disabled !selected', '#ffffff', 'selected', '#4a6984'
        ]

And this is the native:

        'background': [
            ('disabled','SystemButtonFace'),
            ('!disabled', '!selected', 'SystemWindow'),
            ('selected', 'SystemHighlight')
        ]

from ttkwidgets.

RedFantom avatar RedFantom commented on September 23, 2024

That's most likely an issue on Windows then, as on Linux the style map, even for theme alt, always looks properly formatted. I am currently not in a position to test it, but I will add it to my todo list. That looks like it will make the parsing more complicated though, and that might even be a bug in Tkinter.

from ttkwidgets.

melassa avatar melassa commented on September 23, 2024

I think it is a tkinter bug:

tkinter alt Treeview map (Pyhon 3.8):

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

Tcl alt Treeview map (Python 3.8):

-foreground {disabled #a3a3a3 {!disabled !selected} black selected #ffffff} 
-background {disabled #d9d9d9 {!disabled !selected} #ffffff selected #4a6984}

I think it is more easy to edit the tcl output...

from ttkwidgets.

RedFantom avatar RedFantom commented on September 23, 2024

All right, so I've tried it now on Windows 10 with Python 3.9.1 and Python 3.8.7, and I cannot reproduce this error. The code for _splitdict, which parses the output of the Tcl command called by style.map() actually hasn't changed between these versions, so I'm not sure what's going wrong here.

@melassa What sub-versions of Python are using? Are you using the default CPython distributions from python.org? You are using Windows, right? Python 3.9.1 isn't available for Windows 7, so are you using two different versions of Windows or are you using 3.9.0?

from ttkwidgets.

melassa avatar melassa commented on September 23, 2024

It was a tkinter bug fixed in 3.8.7 (my bugged version was 3.8.6 under W7). You can close this issue.

from ttkwidgets.

RedFantom avatar RedFantom commented on September 23, 2024

Okay, great that you found the problem!

from ttkwidgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.