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
103cc6dd
Kaydet (Commit)
103cc6dd
authored
Nis 14, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch by Craig McPheeters to clean up the back-references to widgets
contained in commands created by those same widgets.
üst
5a56649e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
4 deletions
+46
-4
Tkinter.py
Lib/lib-tk/Tkinter.py
+23
-2
Tkinter.py
Lib/tkinter/Tkinter.py
+23
-2
No files found.
Lib/lib-tk/Tkinter.py
Dosyayı görüntüle @
103cc6dd
...
...
@@ -119,6 +119,19 @@ def getboolean(s):
return
_default_root
.
tk
.
getboolean
(
s
)
class
Misc
:
def
__init__
(
self
):
self
.
_tclCommands
=
None
def
destroy
(
self
):
if
self
.
_tclCommands
is
not
None
:
for
name
in
self
.
_tclCommands
:
#print '- Tkinter: deleted command', name
self
.
tk
.
deletecommand
(
name
)
self
.
_tclCommands
=
None
def
deletecommand
(
self
,
name
):
#print '- Tkinter: deleted command', name
self
.
tk
.
deletecommand
(
name
)
index
=
self
.
_tclCommands
.
index
(
name
)
del
self
.
_tclCommands
[
index
]
def
tk_strictMotif
(
self
,
boolean
=
None
):
return
self
.
tk
.
getboolean
(
self
.
tk
.
call
(
'set'
,
'tk_strictMotif'
,
boolean
))
...
...
@@ -184,11 +197,11 @@ class Misc:
else
:
# XXX Disgusting hack to clean up after calling func
tmp
=
[]
def
callit
(
func
=
func
,
args
=
args
,
tk
=
self
.
tk
,
tmp
=
tmp
):
def
callit
(
func
=
func
,
args
=
args
,
self
=
self
,
tmp
=
tmp
):
try
:
apply
(
func
,
args
)
finally
:
tk
.
deletecommand
(
tmp
[
0
])
self
.
deletecommand
(
tmp
[
0
])
name
=
self
.
_register
(
callit
)
tmp
.
append
(
name
)
return
self
.
tk
.
call
(
'after'
,
ms
,
name
)
...
...
@@ -504,6 +517,10 @@ class Misc:
except
AttributeError
:
pass
self
.
tk
.
createcommand
(
name
,
f
)
if
self
.
_tclCommands
is
None
:
self
.
_tclCommands
=
[]
self
.
_tclCommands
.
append
(
name
)
#print '+ Tkinter created command', name
return
name
register
=
_register
def
_root
(
self
):
...
...
@@ -644,6 +661,7 @@ class Wm:
class
Tk
(
Misc
,
Wm
):
_w
=
'.'
def
__init__
(
self
,
screenName
=
None
,
baseName
=
None
,
className
=
'Tk'
):
Misc
.
__init__
(
self
)
global
_default_root
self
.
master
=
None
self
.
children
=
{}
...
...
@@ -685,6 +703,7 @@ class Tk(Misc, Wm):
def
destroy
(
self
):
for
c
in
self
.
children
.
values
():
c
.
destroy
()
self
.
tk
.
call
(
'destroy'
,
self
.
_w
)
Misc
.
destroy
(
self
)
def
__str__
(
self
):
return
self
.
_w
def
readprofile
(
self
,
baseName
,
className
):
...
...
@@ -888,6 +907,7 @@ class Widget(Misc, Pack, Place, Grid):
self
.
master
.
children
[
self
.
_name
]
.
destroy
()
self
.
master
.
children
[
self
.
_name
]
=
self
def
__init__
(
self
,
master
,
widgetName
,
cnf
=
{},
kw
=
{},
extra
=
()):
Misc
.
__init__
(
self
)
if
kw
:
cnf
=
_cnfmerge
((
cnf
,
kw
))
self
.
widgetName
=
widgetName
...
...
@@ -935,6 +955,7 @@ class Widget(Misc, Pack, Place, Grid):
if
self
.
master
.
children
.
has_key
(
self
.
_name
):
del
self
.
master
.
children
[
self
.
_name
]
self
.
tk
.
call
(
'destroy'
,
self
.
_w
)
Misc
.
destroy
(
self
)
def
_do
(
self
,
name
,
args
=
()):
return
apply
(
self
.
tk
.
call
,
(
self
.
_w
,
name
)
+
args
)
...
...
Lib/tkinter/Tkinter.py
Dosyayı görüntüle @
103cc6dd
...
...
@@ -119,6 +119,19 @@ def getboolean(s):
return
_default_root
.
tk
.
getboolean
(
s
)
class
Misc
:
def
__init__
(
self
):
self
.
_tclCommands
=
None
def
destroy
(
self
):
if
self
.
_tclCommands
is
not
None
:
for
name
in
self
.
_tclCommands
:
#print '- Tkinter: deleted command', name
self
.
tk
.
deletecommand
(
name
)
self
.
_tclCommands
=
None
def
deletecommand
(
self
,
name
):
#print '- Tkinter: deleted command', name
self
.
tk
.
deletecommand
(
name
)
index
=
self
.
_tclCommands
.
index
(
name
)
del
self
.
_tclCommands
[
index
]
def
tk_strictMotif
(
self
,
boolean
=
None
):
return
self
.
tk
.
getboolean
(
self
.
tk
.
call
(
'set'
,
'tk_strictMotif'
,
boolean
))
...
...
@@ -184,11 +197,11 @@ class Misc:
else
:
# XXX Disgusting hack to clean up after calling func
tmp
=
[]
def
callit
(
func
=
func
,
args
=
args
,
tk
=
self
.
tk
,
tmp
=
tmp
):
def
callit
(
func
=
func
,
args
=
args
,
self
=
self
,
tmp
=
tmp
):
try
:
apply
(
func
,
args
)
finally
:
tk
.
deletecommand
(
tmp
[
0
])
self
.
deletecommand
(
tmp
[
0
])
name
=
self
.
_register
(
callit
)
tmp
.
append
(
name
)
return
self
.
tk
.
call
(
'after'
,
ms
,
name
)
...
...
@@ -504,6 +517,10 @@ class Misc:
except
AttributeError
:
pass
self
.
tk
.
createcommand
(
name
,
f
)
if
self
.
_tclCommands
is
None
:
self
.
_tclCommands
=
[]
self
.
_tclCommands
.
append
(
name
)
#print '+ Tkinter created command', name
return
name
register
=
_register
def
_root
(
self
):
...
...
@@ -644,6 +661,7 @@ class Wm:
class
Tk
(
Misc
,
Wm
):
_w
=
'.'
def
__init__
(
self
,
screenName
=
None
,
baseName
=
None
,
className
=
'Tk'
):
Misc
.
__init__
(
self
)
global
_default_root
self
.
master
=
None
self
.
children
=
{}
...
...
@@ -685,6 +703,7 @@ class Tk(Misc, Wm):
def
destroy
(
self
):
for
c
in
self
.
children
.
values
():
c
.
destroy
()
self
.
tk
.
call
(
'destroy'
,
self
.
_w
)
Misc
.
destroy
(
self
)
def
__str__
(
self
):
return
self
.
_w
def
readprofile
(
self
,
baseName
,
className
):
...
...
@@ -888,6 +907,7 @@ class Widget(Misc, Pack, Place, Grid):
self
.
master
.
children
[
self
.
_name
]
.
destroy
()
self
.
master
.
children
[
self
.
_name
]
=
self
def
__init__
(
self
,
master
,
widgetName
,
cnf
=
{},
kw
=
{},
extra
=
()):
Misc
.
__init__
(
self
)
if
kw
:
cnf
=
_cnfmerge
((
cnf
,
kw
))
self
.
widgetName
=
widgetName
...
...
@@ -935,6 +955,7 @@ class Widget(Misc, Pack, Place, Grid):
if
self
.
master
.
children
.
has_key
(
self
.
_name
):
del
self
.
master
.
children
[
self
.
_name
]
self
.
tk
.
call
(
'destroy'
,
self
.
_w
)
Misc
.
destroy
(
self
)
def
_do
(
self
,
name
,
args
=
()):
return
apply
(
self
.
tk
.
call
,
(
self
.
_w
,
name
)
+
args
)
...
...
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