New submission from Jose Salvatierra <j...@tecladocode.com>:

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.

----------
components: Tkinter, Windows
messages: 355818
nosy: jslvtr, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Changes to tkinter result in (unexpected) widget map call return changes 
wrt. 3.7
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38661>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to