-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ttk::spinbox to tkinter.ttk #76766
Comments
Ttk has a spinbox widget, which is a themed version of Tkinter spinbox, but this is missing from Python's ttk implementation. |
As said in review, I would like to see this added unless there is a good reason for the omission. Still needed are patches for doc and tests. |
Needed tests, documentation, etc. |
Tests that are failing on my computer: ====================================================================== Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 1145, in test_command
self.assertTrue(success)
AssertionError: [] is not true ====================================================================== Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 1199, in test_format
self.assertEqual(len(value), 10)
AssertionError: 1 != 10 ====================================================================== Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 1186, in test_increment
self.assertEqual(self.spin.get(), '5')
AssertionError: '1' != '5'
- 1
+ 5 ====================================================================== Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 1163, in test_to
self.assertEqual(self.spin.get(), '5')
AssertionError: '4' != '5'
- 4
+ 5 ====================================================================== Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 1248, in test_values
self.assertEqual(self.spin.get(), '1')
AssertionError: 'a' != '1'
- a
+ 1 ====================================================================== Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 1220, in test_wrap
self.assertEqual(self.spin.get(), '1')
AssertionError: '10' != '1'
- 10
? -
+ 1 This may be a race condition depended on window manager or speed of CPU or GPU. |
This is because of HiDPI display. Mouse events are generated with pixel coordinates (x=width - 5, y=5), but these coordinates are out of a button on scaled widget. |
If set DPI to low value, the size of a spinbox widget (winfo_width(), winfo_height()) is (185, 20), and the test is passed. If set it to high value, the size is (305, 30), and the test is failed. |
I have fixed tests on HiDPI displays. Two issues are left:
SpinboxTest.OPTIONS doesn't contain "exportselection" Just add these options to the list. Maybe conditionally if they are not supported in 8.5. |
Thanks, I'm guessing the update_idletasks() needed to be called after I've added the options to the list and pushed the changes to the PR. On 02/07/2018 03:21 PM, Serhiy Storchaka wrote:
|
All tests are passed. Ned, is it possible to get this feature in 3.7? I didn't have possibility to merge it before 3.7b1. This is just an addition of a simple class. It should be added years ago, it was not added before just due to oversight. This doesn't affect any other code, but may be used in future enhancements of IDLE. |
It is past the feature code cutoff for 3.7.0 but the risks seem low and the benefit reasonably high. Please make sure it is merged ASAP to allow time for buildbot exposure, etc, prior to 370b2. |
Thank you Ned. |
Thank you for your contribution Alan! |
Thank you for all your help! On 02/09/2018 05:41 AM, Serhiy Storchaka wrote:
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: