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
50866e9e
Kaydet (Commit)
50866e9e
authored
Nis 05, 2019
tarafından
Zackery Spytz
Kaydeden (comit)
Serhiy Storchaka
Nis 05, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-25451: Add transparency methods to tkinter.PhotoImage. (GH-10406)
üst
f66e336f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
0 deletions
+25
-0
3.8.rst
Doc/whatsnew/3.8.rst
+5
-0
__init__.py
Lib/tkinter/__init__.py
+9
-0
test_images.py
Lib/tkinter/test/test_tkinter/test_images.py
+9
-0
2018-11-07-23-44-25.bpo-25451.re_8db.rst
...S.d/next/Library/2018-11-07-23-44-25.bpo-25451.re_8db.rst
+2
-0
No files found.
Doc/whatsnew/3.8.rst
Dosyayı görüntüle @
50866e9e
...
...
@@ -379,6 +379,11 @@ Added method :meth:`~tkinter.Canvas.moveto`
in the :class:`tkinter.Canvas` class.
(Contributed by Juliette Monsel in :issue:`23831`.)
The :class:`tkinter.PhotoImage` class now has
:meth:`~tkinter.PhotoImage.transparency_get` and
:meth:`~tkinter.PhotoImage.transparency_set` methods. (Contributed by
Zackery Spytz in :issue:`25451`.)
time
----
...
...
Lib/tkinter/__init__.py
Dosyayı görüntüle @
50866e9e
...
...
@@ -4124,6 +4124,15 @@ class PhotoImage(Image):
args
=
args
+
(
'-from'
,)
+
tuple
(
from_coords
)
self
.
tk
.
call
(
args
)
def
transparency_get
(
self
,
x
,
y
):
"""Return True if the pixel at x,y is transparent."""
return
self
.
tk
.
getboolean
(
self
.
tk
.
call
(
self
.
name
,
'transparency'
,
'get'
,
x
,
y
))
def
transparency_set
(
self
,
x
,
y
,
boolean
):
"""Set the transparency of the pixel at x,y."""
self
.
tk
.
call
(
self
.
name
,
'transparency'
,
'set'
,
x
,
y
,
boolean
)
class
BitmapImage
(
Image
):
"""Widget which can display images in XBM format."""
...
...
Lib/tkinter/test/test_tkinter/test_images.py
Dosyayı görüntüle @
50866e9e
...
...
@@ -320,6 +320,15 @@ class PhotoImageTest(AbstractTkTest, unittest.TestCase):
self
.
assertEqual
(
image3
.
get
(
0
,
0
),
image
.
get
(
4
,
6
))
self
.
assertEqual
(
image3
.
get
(
1
,
2
),
image
.
get
(
5
,
8
))
def
test_transparency
(
self
):
image
=
self
.
create
()
self
.
assertEqual
(
image
.
transparency_get
(
0
,
0
),
True
)
self
.
assertEqual
(
image
.
transparency_get
(
4
,
6
),
False
)
image
.
transparency_set
(
4
,
6
,
True
)
self
.
assertEqual
(
image
.
transparency_get
(
4
,
6
),
True
)
image
.
transparency_set
(
4
,
6
,
False
)
self
.
assertEqual
(
image
.
transparency_get
(
4
,
6
),
False
)
tests_gui
=
(
MiscTest
,
BitmapImageTest
,
PhotoImageTest
,)
...
...
Misc/NEWS.d/next/Library/2018-11-07-23-44-25.bpo-25451.re_8db.rst
0 → 100644
Dosyayı görüntüle @
50866e9e
Add transparency methods to :class:`tkinter.PhotoImage`. Patch by Zackery
Spytz.
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