
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2019-12-29 13:05 byglombardo, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 17815 | merged | terry.reedy,2020-01-03 23:05 | |
| PR 17839 | merged | miss-islington,2020-01-05 16:24 | |
| PR 17840 | merged | miss-islington,2020-01-05 16:48 | |
| Messages (11) | |||
|---|---|---|---|
| msg358987 -(view) | Author: Giovanni Lombardo (glombardo)* | Date: 2019-12-29 13:05 | |
The issue arises by simply calling configure on the Scale widget of the themed tk (ttk) widgets set:```cursor = scale.configure('cursor')[-1]```The above casues the following error:```File "C:\Users\Giovanni\Tests\test_scale.py", line 604, in main cursor = scale.configure('cursor')[-1]File "C:\Users\Giovanni\AppData\Local\Programs\Python\Python37\lib\tkinter\ttk.py", line 1090, in configure kw.update(cnf)ValueError: dictionary update sequence element #0 has length 1; 2 is required```The interpreter is:```Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32``` | |||
| msg359195 -(view) | Author: Giovanni Lombardo (glombardo)* | Date: 2020-01-02 12:52 | |
I've modified the `Scale.configure` implementation as follows:``` def configure(self, cnf=None, **kw): """Modify or query scale options. Setting a value for any of the "from", "from_" or "to" options generates a <<RangeChanged>> event.""" if cnf: kw.update(cnf) retval = Widget.configure(self, **kw) if any(['from' in kw, 'from_' in kw, 'to' in kw]): self.event_generate('<<RangeChanged>>') return retval```It works as expected for my project, but I don't have regression tests or exahustive code checking in place to verify it behaves correctly for all use cases. How can we manage to perform those tests? | |||
| msg359262 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2020-01-03 22:48 | |
Your code is buggy because 'cursor' is not a dict or anything like one.On the other hand, adding retval to capture and return the return from Widget.configure looks correct. (And it will not prevent kw.update('cursor') from raising. The current code is def configure(self, cnf=None, **kw): """Modify or query scale options. Setting a value for any of the "from", "from_" or "to" options generates a <<RangeChanged>> event.""" if cnf: kw.update(cnf) Widget.configure(self, **kw) if any(['from' in kw, 'from_' in kw, 'to' in kw]): self.event_generate('<<RangeChanged>>'))To review, test, and make the change, a github Pull Request (PR) is needed. I will make one. | |||
| msg359263 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2020-01-03 23:10 | |
Giovanni, a Python exception is a intended exit. A crash is when the program either hangs or stops unintentionally without a python exception but with an OS error message.I checked and Scale is the only ttk widget that overrides configure. | |||
| msg359286 -(view) | Author: Giovanni Lombardo (glombardo)* | Date: 2020-01-04 13:40 | |
Hello Terry J. Reedy, first and foremost thanks for the time you've dedicated to this issue! I really appreciate you work!! Even if I work with Python since 2007, I'm new here, and not very well versed with this issue management system. This has been my first issue, hopefully not the last.. or maybe yes. Anyway, I'm going to clarify some points about your answers: 1: scale.configure('whateveroption') can take the name of an option and should return its value, usually a tuple (unless you've already customized the option's value) as all other widgets already do. 2. The code I've provided is not correct you're right. Mistakenly I've pasted the wrong one, but when I realized it, trying to delete and replace the uncorrect part, I've been unable to find the edit or delete feature on the issue tracker. Sorry for that.3. I'd like to thank you for the clarification you've given about correct definition of crash and exception. I knew them. Anyway I'd like point out that there is no option in the 'create ticket' page of the issue tracker to specify that an exception that shouldn't be raised at all is instead raised. Considering that, if a piece of code is not supposed to raise exceptions managing them involve a runtime overhead we all want to avoid. Eventually the raising of the exception may stop an application abnormally leading to the same effect experienced in an application crash. 4. Exaclty, Scale is the only one widget that override configure. So in theory no other similar issues should be found there.It there is some action I need to do, or some documentation I need to read in order to be able to help here please point me there. Thank you again. | |||
| msg359288 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2020-01-04 13:45 | |
There is a special case in tests for Scale.configure. It should be removed now. And maybe there is an old issue for this? | |||
| msg359289 -(view) | Author: Giovanni Lombardo (glombardo)* | Date: 2020-01-04 13:54 | |
@serhiy.storchaka I didn't found any old issue not closed aboud tkinter Scale widget. | |||
| msg359306 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2020-01-04 19:27 | |
Giovanni, I saw that you gave a correct fix even if your example was wrong. Currently, scale.configure returns None instead of the configuration. Your patch fixes this. Once I created a git branch to verify and test the fix, it was trivial to make a PR, so I did so.My PR still needs to patch the ttk.scale test. If you get an idea of what to do, before I do it, post on the PR if you have a github account, or here. | |||
| msg359351 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2020-01-05 16:24 | |
New changeset5ea7bb25e3b192d6c49a49c9e3b316f8559602aa by Terry Jan Reedy in branch 'master':bpo-39152: add missing ttk.Scale.configure return value (GH-17815)https://github.com/python/cpython/commit/5ea7bb25e3b192d6c49a49c9e3b316f8559602aa | |||
| msg359353 -(view) | Author: miss-islington (miss-islington) | Date: 2020-01-05 16:49 | |
New changeset6234301bb56a9b388a1c3bf51169a2762ea09172 by Miss Islington (bot) in branch '3.7':bpo-39152: add missing ttk.Scale.configure return value (GH-17815)https://github.com/python/cpython/commit/6234301bb56a9b388a1c3bf51169a2762ea09172 | |||
| msg359357 -(view) | Author: miss-islington (miss-islington) | Date: 2020-01-05 17:07 | |
New changeset636a850ed81cf9b8feed523f277b1538bfc5230b by Miss Islington (bot) in branch '3.8':bpo-39152: add missing ttk.Scale.configure return value (GH-17815)https://github.com/python/cpython/commit/636a850ed81cf9b8feed523f277b1538bfc5230b | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:24 | admin | set | github: 83333 |
| 2020-01-05 17:19:13 | terry.reedy | set | status: open -> closed stage: patch review -> resolved resolution: fixed versions: + Python 3.8, Python 3.9 |
| 2020-01-05 17:07:36 | miss-islington | set | messages: +msg359357 |
| 2020-01-05 16:49:52 | miss-islington | set | nosy: +miss-islington messages: +msg359353 |
| 2020-01-05 16:48:59 | miss-islington | set | pull_requests: +pull_request17267 |
| 2020-01-05 16:24:15 | miss-islington | set | pull_requests: +pull_request17266 |
| 2020-01-05 16:24:06 | terry.reedy | set | messages: +msg359351 |
| 2020-01-04 19:27:13 | terry.reedy | set | messages: +msg359306 |
| 2020-01-04 13:54:02 | glombardo | set | messages: +msg359289 |
| 2020-01-04 13:45:20 | serhiy.storchaka | set | messages: +msg359288 |
| 2020-01-04 13:40:58 | glombardo | set | messages: +msg359286 |
| 2020-01-03 23:10:00 | terry.reedy | set | type: crash -> behavior messages: +msg359263 |
| 2020-01-03 23:05:25 | terry.reedy | set | keywords: +patch stage: patch review pull_requests: +pull_request17242 |
| 2020-01-03 22:48:56 | terry.reedy | set | nosy: +terry.reedy,serhiy.storchaka messages: +msg359262 |
| 2020-01-02 12:52:12 | glombardo | set | messages: +msg359195 |
| 2019-12-29 13:05:33 | glombardo | create | |