classification
Title: Changes to tkinter result in (unexpected) widget map call return changes wrt. 3.7
Type: behavior Stage:
Components: Tkinter, Windows Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: j-4321-i, jslvtr, paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2019-11-01 14:32 by jslvtr, last changed 2019-11-07 14:57 by j-4321-i.

Messages (1)
msg355818 - (view) Author: Jose Salvatierra (jslvtr) Date: 2019-11-01 14:32
Hello!

I've encountered what might be a bug.

Up till now we had some working code that did this:

```
maps = self.style.map('TCombobox')
if maps:
    self.style.map('DateEntry', **maps)
```

Modifying a custom style to mimic the map of another. This has worked fine until Python 3.7, because the return value of `.map` is something that you can pass to `.map` as kw and it'll process it fine.

The return value of `.map` in Python 3.7 is something like this, for the `TCombobox`:

```
<class 'dict'>: {'focusfill': [('readonly', 'focus', 'SystemHighlight')], 'foreground': [('disabled', 'SystemGrayText'), ('readonly', 'focus', 'SystemHighlightText')], 'selectforeground': [('!focus', 'SystemWindowText')], 'selectbackground': [('!focus', 'SystemWindow')]}
```

Which is as you'd expect (and the docs say): a dictionary of properties to lists, where each list can contain multiple tuples describing the required state and final value of the property.

However in Python 3.8, the value returned by `.map` is this:

```
<class 'dict'>: {'focusfill': ['readonly focus', 'SystemHighlight'], 'foreground': ['disabled', 'SystemGrayText', 'readonly focus', 'SystemHighlightText'], 'selectforeground': ['!focus', 'SystemWindowText'], 'selectbackground': ['!focus', 'SystemWindow']}
```

The tuples are missing. This then causes a number of problems downstream, such as the final property values being split into the constituent letters instead of the values within each tuple.
History
Date User Action Args
2019-11-07 14:57:49j-4321-isetnosy: + j-4321-i
2019-11-01 15:31:56serhiy.storchakasetnosy: + serhiy.storchaka
2019-11-01 14:32:27jslvtrcreate