Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
97f1ca16
Unverified
Kaydet (Commit)
97f1ca16
authored
Şub 01, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Şub 01, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[3.8] bpo-31508: Remove support of arguments in tkinter.ttk.Treeview.selection. (GH-3651)
It was deprecated in 3.6.
üst
12e7cd8a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
48 deletions
+18
-48
tkinter.ttk.rst
Doc/library/tkinter.ttk.rst
+5
-6
3.8.rst
Doc/whatsnew/3.8.rst
+8
-0
test_widgets.py
Lib/tkinter/test/test_ttk/test_widgets.py
+0
-21
ttk.py
Lib/tkinter/ttk.py
+2
-21
2017-09-19-12-38-31.bpo-31508.pDsFJl.rst
...S.d/next/Library/2017-09-19-12-38-31.bpo-31508.pDsFJl.rst
+3
-0
No files found.
Doc/library/tkinter.ttk.rst
Dosyayı görüntüle @
97f1ca16
...
...
@@ -1094,14 +1094,13 @@ ttk.Treeview
the tree.
.. method:: selection(
selop=None, items=None
)
.. method:: selection()
If *selop* is not specified, returns selected items. Otherwise, it will
act according to the following selection methods.
Returns a tuple of selected items.
..
deprecated-removed:: 3.6
3.8
Using ``selection()`` for changing the selection state is deprecated.
Use the following selection methods instead
.
..
versionchanged::
3.8
``selection()`` no longer takes arguments. For changing the selection
state use the following selection methods
.
.. method:: selection_set(*items)
...
...
Doc/whatsnew/3.8.rst
Dosyayı görüntüle @
97f1ca16
...
...
@@ -113,3 +113,11 @@ This section lists previously described changes and other bugfixes
that may require changes to your code.
Changes in the Python API
-------------------------
* The :meth:`~tkinter.ttk.Treeview.selection` method of the
:class:`tkinter.ttk.Treeview` class no longer takes arguments. Using it with
arguments for changing the selection was deprecated in Python 3.6. Use
specialized methods like :meth:`~tkinter.ttk.Treeview.selection_set` for
changing the selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)
Lib/tkinter/test/test_ttk/test_widgets.py
Dosyayı görüntüle @
97f1ca16
...
...
@@ -1556,27 +1556,6 @@ class TreeviewTest(AbstractWidgetTest, unittest.TestCase):
self
.
tv
.
selection_toggle
((
c1
,
c3
))
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c3
,
item2
))
if
sys
.
version_info
>=
(
3
,
8
):
import
warnings
warnings
.
warn
(
'Deprecated API of Treeview.selection() should be removed'
)
self
.
tv
.
selection_set
()
self
.
assertEqual
(
self
.
tv
.
selection
(),
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
tv
.
selection
(
'set'
,
(
c1
,
item2
))
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c1
,
item2
))
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
tv
.
selection
(
'add'
,
(
c1
,
item1
))
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
item1
,
c1
,
item2
))
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
tv
.
selection
(
'remove'
,
(
item1
,
c3
))
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c1
,
item2
))
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
tv
.
selection
(
'toggle'
,
(
c1
,
c3
))
self
.
assertEqual
(
self
.
tv
.
selection
(),
(
c3
,
item2
))
with
self
.
assertWarns
(
DeprecationWarning
):
selection
=
self
.
tv
.
selection
(
None
)
self
.
assertEqual
(
selection
,
(
c3
,
item2
))
def
test_set
(
self
):
self
.
tv
[
'columns'
]
=
[
'A'
,
'B'
]
...
...
Lib/tkinter/ttk.py
Dosyayı görüntüle @
97f1ca16
...
...
@@ -28,8 +28,6 @@ __all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label",
import
tkinter
from
tkinter
import
_flatten
,
_join
,
_stringify
,
_splitdict
_sentinel
=
object
()
# Verify if Tk is new enough to not need the Tile package
_REQUIRE_TILE
=
True
if
tkinter
.
TkVersion
<
8.5
else
False
...
...
@@ -1396,26 +1394,9 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
self
.
tk
.
call
(
self
.
_w
,
"see"
,
item
)
def
selection
(
self
,
selop
=
_sentinel
,
items
=
None
):
def
selection
(
self
):
"""Returns the tuple of selected items."""
if
selop
is
_sentinel
:
selop
=
None
elif
selop
is
None
:
import
warnings
warnings
.
warn
(
"The selop=None argument of selection() is deprecated "
"and will be removed in Python 3.8"
,
DeprecationWarning
,
3
)
elif
selop
in
(
'set'
,
'add'
,
'remove'
,
'toggle'
):
import
warnings
warnings
.
warn
(
"The selop argument of selection() is deprecated "
"and will be removed in Python 3.8, "
"use selection_
%
s() instead"
%
(
selop
,),
DeprecationWarning
,
3
)
else
:
raise
TypeError
(
'Unsupported operation'
)
return
self
.
tk
.
splitlist
(
self
.
tk
.
call
(
self
.
_w
,
"selection"
,
selop
,
items
))
return
self
.
tk
.
splitlist
(
self
.
tk
.
call
(
self
.
_w
,
"selection"
))
def
_selection
(
self
,
selop
,
items
):
...
...
Misc/NEWS.d/next/Library/2017-09-19-12-38-31.bpo-31508.pDsFJl.rst
0 → 100644
Dosyayı görüntüle @
97f1ca16
Removed support of arguments in `tkinter.ttk.Treeview.selection`. It was
deprecated in 3.6. Use specialized methods like `selection_set` for
changing the selection.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment