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
c4570487
Kaydet (Commit)
c4570487
authored
Mar 20, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Give in to the tab police.
üst
6f73c1a2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
132 additions
and
122 deletions
+132
-122
Canvas.py
Lib/lib-tk/Canvas.py
+18
-18
FileDialog.py
Lib/lib-tk/FileDialog.py
+0
-0
SimpleDialog.py
Lib/lib-tk/SimpleDialog.py
+78
-78
Tkinter.py
Lib/lib-tk/Tkinter.py
+27
-17
tkCommonDialog.py
Lib/lib-tk/tkCommonDialog.py
+3
-3
tkFileDialog.py
Lib/lib-tk/tkFileDialog.py
+6
-6
No files found.
Lib/lib-tk/Canvas.py
Dosyayı görüntüle @
c4570487
...
...
@@ -78,41 +78,41 @@ class CanvasItem:
return
self
.
canvas
.
type
(
self
.
id
)
class
Arc
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'arc'
)
+
args
,
kw
)
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'arc'
)
+
args
,
kw
)
class
Bitmap
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'bitmap'
)
+
args
,
kw
)
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'bitmap'
)
+
args
,
kw
)
class
ImageItem
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'image'
)
+
args
,
kw
)
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'image'
)
+
args
,
kw
)
class
Line
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'line'
)
+
args
,
kw
)
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'line'
)
+
args
,
kw
)
class
Oval
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'oval'
)
+
args
,
kw
)
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'oval'
)
+
args
,
kw
)
class
Polygon
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'polygon'
)
+
args
,
kw
)
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'polygon'
)
+
args
,
kw
)
class
Rectangle
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'rectangle'
)
+
args
,
kw
)
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'rectangle'
)
+
args
,
kw
)
# XXX "Text" is taken by the Text widget...
class
CanvasText
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'text'
)
+
args
,
kw
)
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'text'
)
+
args
,
kw
)
class
Window
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'window'
)
+
args
,
kw
)
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'window'
)
+
args
,
kw
)
class
Group
:
def
__init__
(
self
,
canvas
,
tag
=
None
):
...
...
Lib/lib-tk/FileDialog.py
Dosyayı görüntüle @
c4570487
This diff is collapsed.
Click to expand it.
Lib/lib-tk/SimpleDialog.py
Dosyayı görüntüle @
c4570487
...
...
@@ -7,99 +7,99 @@ from Tkinter import *
class
SimpleDialog
:
def
__init__
(
self
,
master
,
text
=
''
,
buttons
=
[],
default
=
None
,
cancel
=
None
,
title
=
None
,
class_
=
None
):
if
class_
:
self
.
root
=
Toplevel
(
master
,
class_
=
class_
)
else
:
self
.
root
=
Toplevel
(
master
)
if
title
:
self
.
root
.
title
(
title
)
self
.
root
.
iconname
(
title
)
self
.
message
=
Message
(
self
.
root
,
text
=
text
,
aspect
=
400
)
self
.
message
.
pack
(
expand
=
1
,
fill
=
BOTH
)
self
.
frame
=
Frame
(
self
.
root
)
self
.
frame
.
pack
()
self
.
num
=
default
self
.
cancel
=
cancel
self
.
default
=
default
self
.
root
.
bind
(
'<Return>'
,
self
.
return_event
)
for
num
in
range
(
len
(
buttons
)):
s
=
buttons
[
num
]
b
=
Button
(
self
.
frame
,
text
=
s
,
command
=
(
lambda
self
=
self
,
num
=
num
:
self
.
done
(
num
)))
if
num
==
default
:
b
.
config
(
relief
=
RIDGE
,
borderwidth
=
8
)
b
.
pack
(
side
=
LEFT
,
fill
=
BOTH
,
expand
=
1
)
self
.
root
.
protocol
(
'WM_DELETE_WINDOW'
,
self
.
wm_delete_window
)
self
.
_set_transient
(
master
)
text
=
''
,
buttons
=
[],
default
=
None
,
cancel
=
None
,
title
=
None
,
class_
=
None
):
if
class_
:
self
.
root
=
Toplevel
(
master
,
class_
=
class_
)
else
:
self
.
root
=
Toplevel
(
master
)
if
title
:
self
.
root
.
title
(
title
)
self
.
root
.
iconname
(
title
)
self
.
message
=
Message
(
self
.
root
,
text
=
text
,
aspect
=
400
)
self
.
message
.
pack
(
expand
=
1
,
fill
=
BOTH
)
self
.
frame
=
Frame
(
self
.
root
)
self
.
frame
.
pack
()
self
.
num
=
default
self
.
cancel
=
cancel
self
.
default
=
default
self
.
root
.
bind
(
'<Return>'
,
self
.
return_event
)
for
num
in
range
(
len
(
buttons
)):
s
=
buttons
[
num
]
b
=
Button
(
self
.
frame
,
text
=
s
,
command
=
(
lambda
self
=
self
,
num
=
num
:
self
.
done
(
num
)))
if
num
==
default
:
b
.
config
(
relief
=
RIDGE
,
borderwidth
=
8
)
b
.
pack
(
side
=
LEFT
,
fill
=
BOTH
,
expand
=
1
)
self
.
root
.
protocol
(
'WM_DELETE_WINDOW'
,
self
.
wm_delete_window
)
self
.
_set_transient
(
master
)
def
_set_transient
(
self
,
master
,
relx
=
0.5
,
rely
=
0.3
):
widget
=
self
.
root
widget
.
withdraw
()
# Remain invisible while we figure out the geometry
widget
.
transient
(
master
)
widget
.
update_idletasks
()
# Actualize geometry information
if
master
.
winfo_ismapped
():
m_width
=
master
.
winfo_width
()
m_height
=
master
.
winfo_height
()
m_x
=
master
.
winfo_rootx
()
m_y
=
master
.
winfo_rooty
()
else
:
m_width
=
master
.
winfo_screenwidth
()
m_height
=
master
.
winfo_screenheight
()
m_x
=
m_y
=
0
w_width
=
widget
.
winfo_reqwidth
()
w_height
=
widget
.
winfo_reqheight
()
x
=
m_x
+
(
m_width
-
w_width
)
*
relx
y
=
m_y
+
(
m_height
-
w_height
)
*
rely
if
x
+
w_width
>
master
.
winfo_screenwidth
():
x
=
master
.
winfo_screenwidth
()
-
w_width
elif
x
<
0
:
x
=
0
if
y
+
w_height
>
master
.
winfo_screenheight
():
y
=
master
.
winfo_screenheight
()
-
w_height
elif
y
<
0
:
y
=
0
widget
.
geometry
(
"+
%
d+
%
d"
%
(
x
,
y
))
widget
.
deiconify
()
# Become visible at the desired location
widget
=
self
.
root
widget
.
withdraw
()
# Remain invisible while we figure out the geometry
widget
.
transient
(
master
)
widget
.
update_idletasks
()
# Actualize geometry information
if
master
.
winfo_ismapped
():
m_width
=
master
.
winfo_width
()
m_height
=
master
.
winfo_height
()
m_x
=
master
.
winfo_rootx
()
m_y
=
master
.
winfo_rooty
()
else
:
m_width
=
master
.
winfo_screenwidth
()
m_height
=
master
.
winfo_screenheight
()
m_x
=
m_y
=
0
w_width
=
widget
.
winfo_reqwidth
()
w_height
=
widget
.
winfo_reqheight
()
x
=
m_x
+
(
m_width
-
w_width
)
*
relx
y
=
m_y
+
(
m_height
-
w_height
)
*
rely
if
x
+
w_width
>
master
.
winfo_screenwidth
():
x
=
master
.
winfo_screenwidth
()
-
w_width
elif
x
<
0
:
x
=
0
if
y
+
w_height
>
master
.
winfo_screenheight
():
y
=
master
.
winfo_screenheight
()
-
w_height
elif
y
<
0
:
y
=
0
widget
.
geometry
(
"+
%
d+
%
d"
%
(
x
,
y
))
widget
.
deiconify
()
# Become visible at the desired location
def
go
(
self
):
self
.
root
.
grab_set
()
self
.
root
.
mainloop
()
self
.
root
.
destroy
()
return
self
.
num
self
.
root
.
grab_set
()
self
.
root
.
mainloop
()
self
.
root
.
destroy
()
return
self
.
num
def
return_event
(
self
,
event
):
if
self
.
default
is
None
:
self
.
root
.
bell
()
else
:
self
.
done
(
self
.
default
)
if
self
.
default
is
None
:
self
.
root
.
bell
()
else
:
self
.
done
(
self
.
default
)
def
wm_delete_window
(
self
):
if
self
.
cancel
is
None
:
self
.
root
.
bell
()
else
:
self
.
done
(
self
.
cancel
)
if
self
.
cancel
is
None
:
self
.
root
.
bell
()
else
:
self
.
done
(
self
.
cancel
)
def
done
(
self
,
num
):
self
.
num
=
num
self
.
root
.
quit
()
self
.
num
=
num
self
.
root
.
quit
()
def
test
():
root
=
Tk
()
def
doit
(
root
=
root
):
d
=
SimpleDialog
(
root
,
text
=
"This is a test dialog. "
"Would this have been an actual dialog, "
"the buttons below would have been glowing "
"in soft pink light.
\n
"
"Do you believe this?"
,
buttons
=
[
"Yes"
,
"No"
,
"Cancel"
],
default
=
0
,
cancel
=
2
,
title
=
"Test Dialog"
)
print
d
.
go
()
d
=
SimpleDialog
(
root
,
text
=
"This is a test dialog. "
"Would this have been an actual dialog, "
"the buttons below would have been glowing "
"in soft pink light.
\n
"
"Do you believe this?"
,
buttons
=
[
"Yes"
,
"No"
,
"Cancel"
],
default
=
0
,
cancel
=
2
,
title
=
"Test Dialog"
)
print
d
.
go
()
t
=
Button
(
root
,
text
=
'Test'
,
command
=
doit
)
t
.
pack
()
q
=
Button
(
root
,
text
=
'Quit'
,
command
=
t
.
quit
)
...
...
Lib/lib-tk/Tkinter.py
Dosyayı görüntüle @
c4570487
...
...
@@ -51,8 +51,14 @@ def _cnfmerge(cnfs):
class
Event
:
pass
_support_default_root
=
1
_default_root
=
None
def
NoDefaultRoot
():
global
_support_default_root
_support_default_root
=
0
del
_default_root
def
_tkerror
(
err
):
pass
...
...
@@ -536,7 +542,7 @@ class Misc:
if
needcleanup
:
if
self
.
_tclCommands
is
None
:
self
.
_tclCommands
=
[]
self
.
_tclCommands
.
append
(
name
)
self
.
_tclCommands
.
append
(
name
)
#print '+ Tkinter created command', name
return
name
register
=
_register
...
...
@@ -702,6 +708,7 @@ class Misc:
# Support for the "event" command, new in Tk 4.2.
# By Case Roole.
# XXX Why is this using the default root?
def
event_add
(
self
,
virtual
,
*
sequences
):
args
=
(
'event'
,
'add'
,
virtual
)
+
sequences
...
...
@@ -795,7 +802,7 @@ class Wm:
def
positionfrom
(
self
,
who
=
None
):
return
self
.
tk
.
call
(
'wm'
,
'positionfrom'
,
self
.
_w
,
who
)
def
protocol
(
self
,
name
=
None
,
func
=
None
):
if
callable
(
func
):
if
callable
(
func
):
command
=
self
.
_register
(
func
)
else
:
command
=
func
...
...
@@ -857,14 +864,14 @@ class Tk(Misc, Wm):
self
.
tk
.
createcommand
(
'tkerror'
,
_tkerror
)
self
.
tk
.
createcommand
(
'exit'
,
_exit
)
self
.
readprofile
(
baseName
,
className
)
if
not
_default_root
:
if
_support_default_root
and
not
_default_root
:
_default_root
=
self
def
destroy
(
self
):
for
c
in
self
.
children
.
values
():
c
.
destroy
()
self
.
tk
.
call
(
'destroy'
,
self
.
_w
)
Misc
.
destroy
(
self
)
global
_default_root
if
_default_root
is
self
:
if
_
support_default_root
and
_
default_root
is
self
:
_default_root
=
None
def
readprofile
(
self
,
baseName
,
className
):
import
os
...
...
@@ -994,13 +1001,14 @@ class Grid:
class
BaseWidget
(
Misc
):
def
_setup
(
self
,
master
,
cnf
):
global
_default_root
if
not
master
:
if
_support_default_root
:
global
_default_root
if
not
master
:
if
not
_default_root
:
_default_root
=
Tk
()
master
=
_default_root
if
not
_default_root
:
_default_root
=
Tk
()
master
=
_default_root
if
not
_default_root
:
_default_root
=
master
_default_root
=
master
self
.
master
=
master
self
.
tk
=
master
.
tk
name
=
None
...
...
@@ -1693,10 +1701,12 @@ class OptionMenu(Menubutton):
self
.
__menu
=
None
class
Image
:
def
__init__
(
self
,
imgtype
,
name
=
None
,
cnf
=
{},
**
kw
):
def
__init__
(
self
,
imgtype
,
name
=
None
,
cnf
=
{},
master
=
None
,
**
kw
):
self
.
name
=
None
master
=
_default_root
if
not
master
:
raise
RuntimeError
,
'Too early to create image'
if
not
master
:
master
=
_default_root
if
not
master
:
raise
RuntimeError
,
'Too early to create image'
self
.
tk
=
master
.
tk
if
not
name
:
name
=
`id(self)`
...
...
@@ -1741,8 +1751,8 @@ class Image:
self
.
tk
.
call
(
'image'
,
'width'
,
self
.
name
))
class
PhotoImage
(
Image
):
def
__init__
(
self
,
name
=
None
,
cnf
=
{},
**
kw
):
apply
(
Image
.
__init__
,
(
self
,
'photo'
,
name
,
cnf
),
kw
)
def
__init__
(
self
,
name
=
None
,
cnf
=
{},
master
=
None
,
**
kw
):
apply
(
Image
.
__init__
,
(
self
,
'photo'
,
name
,
cnf
,
master
),
kw
)
def
blank
(
self
):
self
.
tk
.
call
(
self
.
name
,
'blank'
)
def
cget
(
self
,
option
):
...
...
@@ -1784,8 +1794,8 @@ class PhotoImage(Image):
apply
(
self
.
tk
.
call
,
args
)
class
BitmapImage
(
Image
):
def
__init__
(
self
,
name
=
None
,
cnf
=
{},
**
kw
):
apply
(
Image
.
__init__
,
(
self
,
'bitmap'
,
name
,
cnf
),
kw
)
def
__init__
(
self
,
name
=
None
,
cnf
=
{},
master
=
None
,
**
kw
):
apply
(
Image
.
__init__
,
(
self
,
'bitmap'
,
name
,
cnf
,
master
),
kw
)
def
image_names
():
return
_default_root
.
tk
.
call
(
'image'
,
'names'
)
def
image_types
():
return
_default_root
.
tk
.
call
(
'image'
,
'types'
)
...
...
Lib/lib-tk/tkCommonDialog.py
Dosyayı görüntüle @
c4570487
...
...
@@ -25,7 +25,7 @@ class Dialog:
if
TkVersion
<
4.2
:
raise
TclError
,
"this module requires Tk 4.2 or newer"
self
.
master
=
master
self
.
master
=
master
self
.
options
=
options
def
_fixoptions
(
self
):
...
...
@@ -37,8 +37,8 @@ class Dialog:
def
show
(
self
,
**
options
):
# update instance options
for
k
,
v
in
options
.
items
():
self
.
options
[
k
]
=
v
for
k
,
v
in
options
.
items
():
self
.
options
[
k
]
=
v
self
.
_fixoptions
()
...
...
Lib/lib-tk/tkFileDialog.py
Dosyayı görüntüle @
c4570487
...
...
@@ -41,14 +41,14 @@ class _Dialog(Dialog):
pass
def
_fixresult
(
self
,
widget
,
result
):
if
result
:
# keep directory and filename until next time
if
result
:
# keep directory and filename until next time
import
os
path
,
file
=
os
.
path
.
split
(
result
)
self
.
options
[
"initialdir"
]
=
path
self
.
options
[
"initialfile"
]
=
file
path
,
file
=
os
.
path
.
split
(
result
)
self
.
options
[
"initialdir"
]
=
path
self
.
options
[
"initialfile"
]
=
file
self
.
filename
=
result
# compatibility
return
result
return
result
#
...
...
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