Commit Graph

147 Commits

Author SHA1 Message Date
Ethan Furman 503cdc7c12
Revert "bpo-38659: [Enum] add _simple_enum decorator (GH-25285)" (GH-25476)
This reverts commit dbac8f40e8.
2021-04-19 19:12:24 -07:00
Ethan Furman dbac8f40e8
bpo-38659: [Enum] add _simple_enum decorator (GH-25285)
add:

_simple_enum decorator to transform a normal class into an enum
_test_simple_enum function to compare
_old_convert_ to enable checking _convert_ generated enums
_simple_enum takes a normal class and converts it into an enum:

@simple_enum(Enum)
class Color:
    RED = 1
    GREEN = 2
    BLUE = 3

_old_convert_ works much like _convert_ does, using the original logic:

# in a test file
import socket, enum
CheckedAddressFamily = enum._old_convert_(
        enum.IntEnum, 'AddressFamily', 'socket',
        lambda C: C.isupper() and C.startswith('AF_'),
        source=_socket,
        )

test_simple_enum takes a traditional enum and a simple enum and
compares the two:

# in the REPL or the same module as Color
class CheckedColor(Enum):
    RED = 1
    GREEN = 2
    BLUE = 3

_test_simple_enum(CheckedColor, Color)

_test_simple_enum(CheckedAddressFamily, socket.AddressFamily)

Any important differences will raise a TypeError
2021-04-19 18:04:53 -07:00
Cheryl Sabella 6713e869c4
bpo-33289: Return RGB triplet of ints instead of floats from tkinter.colorchooser (GH-6578) 2021-01-21 21:14:04 +02:00
Serhiy Storchaka 1df56bc059
bpo-42759: Fix equality comparison of Variable and Font in Tkinter (GH-23968)
Objects which belong to different Tcl interpreters are now always
different, even if they have the same name.
2020-12-29 12:56:55 +02:00
Serhiy Storchaka 675c97eb6c
bpo-42721: Improve using simple dialogs without root window (GH-23897)
When simple query dialogs (tkinter.simpledialog), message boxes
(tkinter.messagebox) or color choose dialog (tkinter.colorchooser)
are created without arguments master and parent, and the default
root window is not yet created, a new temporary hidden root window
will be created automatically. It will not be set as the default root
window and will be destroyed right after closing the dialog window.
It will help to use these simple dialog windows in programs which do
not need other GUI.

Previously, message boxes and color chooser created the blank root
window and left it after closing the dialog window, and query dialogs
just raised an exception.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-12-25 20:19:20 +02:00
Serhiy Storchaka bb70b2afe3
bpo-15303: Support widgets with boolean value False in Tkinter (GH-23904)
Use `widget is None` instead of checking the boolean value of a widget.
2020-12-25 17:04:26 +02:00
Serhiy Storchaka 3d569fd6dc
bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781)
* Tkinter functions and constructors which need a default root window
  raise now RuntimeError with descriptive message instead of obscure
  AttributeError or NameError if it is not created yet or cannot
  be created automatically.

* Add tests for all functions which use default root window.

* Fix import in the pynche script.
2020-12-19 12:17:08 +02:00
Serhiy Storchaka eb38c6b7aa
bpo-41831: Restore str implementation of __str__ in tkinter.EventType (GH-22355) 2020-10-09 22:57:34 +03:00
Ethan Furman ea0711a9f9
bpo-41817: use new StrEnum to ensure all members are strings (GH-22348)
* use new StrEnum to ensure all members are strings
2020-09-22 08:01:17 -07:00
Akuli f1d40f941a
bpo-41384: Raise TclError in tkinter.OptionMenu (GH-21601)
... when an unknown option is passed.  TypeError was being raised because a 2to3 fix was missing.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-07-26 21:48:17 -04:00
Serhiy Storchaka 138ccbb022
bpo-38738: Fix formatting of True and False. (GH-17083)
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>".
2019-11-12 16:57:03 +02:00
Serhiy Storchaka 1f21eaa15e
bpo-15999: Clean up of handling boolean arguments. (GH-15610)
* Use the 'p' format unit instead of manually called PyObject_IsTrue().
* Pass boolean value instead 0/1 integers to functions that needs boolean.
* Convert some arguments to boolean only once.
2019-09-01 12:16:51 +03:00
Serhiy Storchaka 662db125cd
bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)
They now return NotImplemented for unsupported type of the other operand.
2019-08-08 08:42:54 +03:00
Flavian Hautbois 76b645124b bpo-29446: tkinter 'import *' only imports what it should (GH-14864)
Add __all__ to tkinter.__init__ and submodules.  Replace 'import *'
with explicit imports in some submodules.
2019-07-25 21:30:33 -04:00
Zackery Spytz 50866e9ed3 bpo-25451: Add transparency methods to tkinter.PhotoImage. (GH-10406) 2019-04-05 13:17:13 +03:00
Juliette Monsel 1deea5e539 bpo-34936: Fix TclError in tkinter.Spinbox.selection_element(). (GH-9760) 2018-10-18 22:28:31 +03:00
Juliette Monsel bf034715db bpo-23831: Add moveto method to the tkinter.Canvas widget. (GH-9768) 2018-10-12 19:44:10 +03:00
Serhiy Storchaka dc0d571b64
bpo-34964: Make Tkinter sources more readable by adding blank lines. (GH-9822) 2018-10-12 19:01:00 +03:00
Juliette Monsel af5658ae93 bpo-34829: Add missing selection_ methods to the Tkinter Spinbox. (GH-9617)
Implement the methods selection_from(), selection_range(), selection_present()
and selection_to() for Tkinter Spinbox.
2018-10-08 19:29:24 +03:00
Serhiy Storchaka 5bb5bbfca8
bpo-33974: Fix passing special characters to ttk widgets. (GH-7986)
Fix passing lists and tuples of strings containing special characters
'"', '\\', '{', '}' and '\n' as options to tkinter.ttk widgets.
2018-06-30 09:20:28 +03:00
Andrés Delfino 4b685bf719 bpo-33283: Mention PNG as a supported format by Tcl/Tk. (GH-6479) 2018-04-17 08:34:35 +03:00
Cheryl Sabella 74382a3f17 bpo-32857: Raise error when tkinter after_cancel() is called with None. (GH-5701) 2018-03-04 12:41:47 +02:00
Vijay Kumar 128641d17e Fix spelling mistakes in tkinter.py (#1716)
Ran the docstrings through spell checker, and fixed spelling issues.
2017-05-22 19:23:52 +03:00
Serhiy Storchaka 016a9acb26 Issue #27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused
by representing the scale as float value internally in Tk.  tkinter.IntVar
now works if float value is set to underlying Tk variable.
2016-10-30 18:52:02 +02:00
Serhiy Storchaka 32c0d3ada5 Issue #27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused
by representing the scale as float value internally in Tk.  tkinter.IntVar
now works if float value is set to underlying Tk variable.
2016-10-30 18:49:52 +02:00
Serhiy Storchaka b1f5287952 Issue #27025: Generated names for Tkinter widgets now start by the "!" prefix
for readability (was "`").
2016-10-25 09:43:48 +03:00
Raymond Hettinger 15f44ab043 Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-08-30 10:47:49 -07:00
Serhiy Storchaka 745a407df8 Issue #22115: Fixed tracing Tkinter variables:
* tracing in the "u" mode now works
* trace_vdelete() with wrong mode no longer break tracing
* trace_vinfo() now always returns a list of pairs of strings
2016-06-26 17:42:23 +03:00
Serhiy Storchaka 8122174af1 Issue #22115: Added methods trace_add, trace_remove and trace_info in the
tkinter.Variable class.  They replace old methods trace_variable, trace,
trace_vdelete and trace_vinfo that use obsolete Tcl commands and might
not work in future versions of Tcl.
2016-06-26 09:46:57 +03:00
Serhiy Storchaka 6bc87b4b4d Issue #20350. tkapp.splitlist() is now always used instead of unreliable
tkapp.split() in the tkinter package.
2016-06-26 00:09:19 +03:00
Serhiy Storchaka 9c6c3fb435 Issue #27294: Numerical state in the repr for Tkinter event objects is now
represented as a compination of known flags.
2016-06-18 21:55:26 +03:00
Serhiy Storchaka 8acb568c88 Issue #27025: Generated names for Tkinter widgets are now more meanful
and recognizirable.
2016-06-13 09:24:11 +03:00
Serhiy Storchaka d611f4cf10 Issue #27294: Improved repr for Tkinter event objects. 2016-06-12 00:19:44 +03:00
Martin Panter 0b7d84de6b Issue #27171: Merge typo fixes from 3.5 2016-06-02 10:11:18 +00:00
Martin Panter e26da7c03a Issue #27171: Fix typos in documentation, comments, and test function names 2016-06-02 10:07:09 +00:00
Serhiy Storchaka 2e208b7d62 Issue #27031: Removed dummy methods in Tkinter widget classes: tk_menuBar()
and tk_bindForTraversal().
2016-05-16 22:35:46 +03:00
Martin Panter 1ce738e08f Merge typo fixes from 3.5 2016-05-08 14:02:35 +00:00
Martin Panter 4c35964b76 Corrections for a/an in code comments and documentation 2016-05-08 13:53:41 +00:00
Martin Panter f0564164ba Fix typos in comments, documentation and test method names 2016-05-08 13:48:10 +00:00
Serhiy Storchaka 159e5359d9 Remove outdated TkVersion checks.
Minimal supported Tcl/Tk version is 8.4, and this is checked in _tkinter.c.
2016-04-25 13:49:11 +03:00
Serhiy Storchaka b6a9c9761c Issue #26778: Fixed "a/an/and" typos in code comment, documentation and error
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka 6a7b3a77b4 Issue #26778: Fixed "a/an/and" typos in code comment and documentation. 2016-04-17 08:32:47 +03:00
Terry Jan Reedy a55553d7e3 Merge with 3.5 2016-03-11 15:31:02 -05:00
Terry Jan Reedy ca0250a878 Issue 25959: Explain in docstring that PhotoImage.zoom arguments are
multipliers, not final sizes.  Explain y default for .zoom and .subsample.
Initial patch by Serhiy Storchaka.
2016-03-11 15:30:35 -05:00
Serhiy Storchaka 2d68f18656 Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets. 2016-03-09 10:52:08 +02:00
Serhiy Storchaka 42a4366ad5 Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets.
Added few missed tests for configure options.
2016-03-09 10:33:51 +02:00
Martin Panter 3008b1c4bb Issue #26304: Merge doc wording from 3.5 2016-02-10 05:44:56 +00:00
Martin Panter c04fb56e36 Issue #26304: Change "allows to <verb>" to "allows <verb>ing" or similar
The original form is incorrect grammar and feels awkward, even though the
meaning is clear.
2016-02-10 05:44:01 +00:00
Serhiy Storchaka b9d672491d Issue #25263: Trying to fix test_use on Windows.
Avoid possible weird behavior of WideInt convertion.
"winfo id" always returns string hexadecimal representation.
2015-11-09 14:43:31 +02:00
Serhiy Storchaka a84f6c3dd3 Issue #25523: Merge a-to-an corrections from 3.4. 2015-11-02 14:39:05 +02:00