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
bbc57d73
Kaydet (Commit)
bbc57d73
authored
May 16, 2008
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Step 1 of Tkinter renaming: move lib-tk modules into a new "tkinter" package.
üst
ae6b9f3c
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
52 additions
and
51 deletions
+52
-51
__init__.py
Lib/tkinter/__init__.py
+10
-9
_fix.py
Lib/tkinter/_fix.py
+0
-0
colorchooser.py
Lib/tkinter/colorchooser.py
+1
-1
commondialog.py
Lib/tkinter/commondialog.py
+3
-3
constants.py
Lib/tkinter/constants.py
+0
-0
dialog.py
Lib/tkinter/dialog.py
+3
-3
dnd.py
Lib/tkinter/dnd.py
+6
-6
filedialog.py
Lib/tkinter/filedialog.py
+2
-2
font.py
Lib/tkinter/font.py
+9
-9
messagebox.py
Lib/tkinter/messagebox.py
+1
-1
scrolledtext.py
Lib/tkinter/scrolledtext.py
+2
-2
simpledialog.py
Lib/tkinter/simpledialog.py
+1
-1
tix.py
Lib/tkinter/tix.py
+9
-9
turtle.py
Lib/tkinter/turtle.py
+5
-5
No files found.
Lib/
lib-tk/Tkinter
.py
→
Lib/
tkinter/__init__
.py
Dosyayı görüntüle @
bbc57d73
...
@@ -18,14 +18,14 @@ Actions are bound to events by resources (e.g. keyword argument
...
@@ -18,14 +18,14 @@ Actions are bound to events by resources (e.g. keyword argument
command) or with the method bind.
command) or with the method bind.
Example (Hello, World):
Example (Hello, World):
import
T
kinter
import
t
kinter
from
Tk
constants import *
from
tkinter.
constants import *
tk =
T
kinter.Tk()
tk =
t
kinter.Tk()
frame =
T
kinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame =
t
kinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
frame.pack(fill=BOTH,expand=1)
label =
T
kinter.Label(frame, text="Hello, World")
label =
t
kinter.Label(frame, text="Hello, World")
label.pack(fill=X, expand=1)
label.pack(fill=X, expand=1)
button =
T
kinter.Button(frame,text="Exit",command=tk.destroy)
button =
t
kinter.Button(frame,text="Exit",command=tk.destroy)
button.pack(side=BOTTOM)
button.pack(side=BOTTOM)
tk.mainloop()
tk.mainloop()
"""
"""
...
@@ -34,12 +34,13 @@ __version__ = "$Revision$"
...
@@ -34,12 +34,13 @@ __version__ = "$Revision$"
import
sys
import
sys
if
sys
.
platform
==
"win32"
:
if
sys
.
platform
==
"win32"
:
import
FixTk
# Attempt to configure Tcl/Tk without requiring PATH
# Attempt to configure Tcl/Tk without requiring PATH
from
tkinter
import
_fix
import
_tkinter
# If this fails your Python may not be configured for Tk
import
_tkinter
# If this fails your Python may not be configured for Tk
tkinter
=
_tkinter
# b/w compat for export
tkinter
=
_tkinter
# b/w compat for export
TclError
=
_tkinter
.
TclError
TclError
=
_tkinter
.
TclError
from
types
import
*
from
types
import
*
from
Tk
constants
import
*
from
tkinter.
constants
import
*
try
:
try
:
import
MacOS
;
_MacOS
=
MacOS
;
del
MacOS
import
MacOS
;
_MacOS
=
MacOS
;
del
MacOS
except
ImportError
:
except
ImportError
:
...
@@ -1696,7 +1697,7 @@ class Tk(Misc, Wm):
...
@@ -1696,7 +1697,7 @@ class Tk(Misc, Wm):
base_tcl
=
os
.
path
.
join
(
home
,
'.
%
s.tcl'
%
baseName
)
base_tcl
=
os
.
path
.
join
(
home
,
'.
%
s.tcl'
%
baseName
)
base_py
=
os
.
path
.
join
(
home
,
'.
%
s.py'
%
baseName
)
base_py
=
os
.
path
.
join
(
home
,
'.
%
s.py'
%
baseName
)
dir
=
{
'self'
:
self
}
dir
=
{
'self'
:
self
}
exec
'from
T
kinter import *'
in
dir
exec
'from
t
kinter import *'
in
dir
if
os
.
path
.
isfile
(
class_tcl
):
if
os
.
path
.
isfile
(
class_tcl
):
self
.
tk
.
call
(
'source'
,
class_tcl
)
self
.
tk
.
call
(
'source'
,
class_tcl
)
if
os
.
path
.
isfile
(
class_py
):
if
os
.
path
.
isfile
(
class_py
):
...
...
Lib/
lib-tk/FixTk
.py
→
Lib/
tkinter/_fix
.py
Dosyayı görüntüle @
bbc57d73
File moved
Lib/
lib-tk/tkColorC
hooser.py
→
Lib/
tkinter/colorc
hooser.py
Dosyayı görüntüle @
bbc57d73
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
# - title: dialog title
# - title: dialog title
#
#
from
tk
CommonD
ialog
import
Dialog
from
tk
inter.commond
ialog
import
Dialog
#
#
...
...
Lib/
lib-tk/tkCommonD
ialog.py
→
Lib/
tkinter/commond
ialog.py
Dosyayı görüntüle @
bbc57d73
# base class for tk common dialogues
# base class for tk common dialogues
#
#
# this module provides a base class for accessing the common
# this module provides a base class for accessing the common
# dialogues available in Tk 4.2 and newer. use
tkFileD
ialog,
# dialogues available in Tk 4.2 and newer. use
filed
ialog,
#
tkColorChooser, and tkMessageB
ox to access the individual
#
colorchooser, and messageb
ox to access the individual
# dialogs.
# dialogs.
#
#
# written by Fredrik Lundh, May 1997
# written by Fredrik Lundh, May 1997
#
#
from
T
kinter
import
*
from
t
kinter
import
*
class
Dialog
:
class
Dialog
:
...
...
Lib/
lib-tk/Tk
constants.py
→
Lib/
tkinter/
constants.py
Dosyayı görüntüle @
bbc57d73
File moved
Lib/
lib-tk/D
ialog.py
→
Lib/
tkinter/d
ialog.py
Dosyayı görüntüle @
bbc57d73
#
D
ialog.py -- Tkinter interface to the tk_dialog script.
#
d
ialog.py -- Tkinter interface to the tk_dialog script.
from
T
kinter
import
*
from
t
kinter
import
*
from
T
kinter
import
_cnfmerge
from
t
kinter
import
_cnfmerge
if
TkVersion
<=
3.6
:
if
TkVersion
<=
3.6
:
DIALOG_ICON
=
'warning'
DIALOG_ICON
=
'warning'
...
...
Lib/
lib-tk/Tk
dnd.py
→
Lib/
tkinter/
dnd.py
Dosyayı görüntüle @
bbc57d73
...
@@ -100,7 +100,7 @@ active; it will never call dnd_commit().
...
@@ -100,7 +100,7 @@ active; it will never call dnd_commit().
"""
"""
import
T
kinter
import
t
kinter
# The factory function
# The factory function
...
@@ -219,7 +219,7 @@ class Icon:
...
@@ -219,7 +219,7 @@ class Icon:
self
.
detach
()
self
.
detach
()
if
not
canvas
:
if
not
canvas
:
return
return
label
=
T
kinter
.
Label
(
canvas
,
text
=
self
.
name
,
label
=
t
kinter
.
Label
(
canvas
,
text
=
self
.
name
,
borderwidth
=
2
,
relief
=
"raised"
)
borderwidth
=
2
,
relief
=
"raised"
)
id
=
canvas
.
create_window
(
x
,
y
,
window
=
label
,
anchor
=
"nw"
)
id
=
canvas
.
create_window
(
x
,
y
,
window
=
label
,
anchor
=
"nw"
)
self
.
canvas
=
canvas
self
.
canvas
=
canvas
...
@@ -268,8 +268,8 @@ class Icon:
...
@@ -268,8 +268,8 @@ class Icon:
class
Tester
:
class
Tester
:
def
__init__
(
self
,
root
):
def
__init__
(
self
,
root
):
self
.
top
=
T
kinter
.
Toplevel
(
root
)
self
.
top
=
t
kinter
.
Toplevel
(
root
)
self
.
canvas
=
T
kinter
.
Canvas
(
self
.
top
,
width
=
100
,
height
=
100
)
self
.
canvas
=
t
kinter
.
Canvas
(
self
.
top
,
width
=
100
,
height
=
100
)
self
.
canvas
.
pack
(
fill
=
"both"
,
expand
=
1
)
self
.
canvas
.
pack
(
fill
=
"both"
,
expand
=
1
)
self
.
canvas
.
dnd_accept
=
self
.
dnd_accept
self
.
canvas
.
dnd_accept
=
self
.
dnd_accept
...
@@ -300,9 +300,9 @@ class Tester:
...
@@ -300,9 +300,9 @@ class Tester:
source
.
attach
(
self
.
canvas
,
x
,
y
)
source
.
attach
(
self
.
canvas
,
x
,
y
)
def
test
():
def
test
():
root
=
T
kinter
.
Tk
()
root
=
t
kinter
.
Tk
()
root
.
geometry
(
"+1+1"
)
root
.
geometry
(
"+1+1"
)
T
kinter
.
Button
(
command
=
root
.
quit
,
text
=
"Quit"
)
.
pack
()
t
kinter
.
Button
(
command
=
root
.
quit
,
text
=
"Quit"
)
.
pack
()
t1
=
Tester
(
root
)
t1
=
Tester
(
root
)
t1
.
top
.
geometry
(
"+1+60"
)
t1
.
top
.
geometry
(
"+1+60"
)
t2
=
Tester
(
root
)
t2
=
Tester
(
root
)
...
...
Lib/
lib-tk/FileD
ialog.py
→
Lib/
tkinter/filed
ialog.py
Dosyayı görüntüle @
bbc57d73
...
@@ -8,8 +8,8 @@ Classes:
...
@@ -8,8 +8,8 @@ Classes:
"""
"""
from
T
kinter
import
*
from
t
kinter
import
*
from
D
ialog
import
Dialog
from
tkinter.d
ialog
import
Dialog
import
os
import
os
import
fnmatch
import
fnmatch
...
...
Lib/
lib-tk/tkF
ont.py
→
Lib/
tkinter/f
ont.py
Dosyayı görüntüle @
bbc57d73
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
__version__
=
"0.9"
__version__
=
"0.9"
import
T
kinter
import
t
kinter
# weight/slant
# weight/slant
NORMAL
=
"normal"
NORMAL
=
"normal"
...
@@ -65,7 +65,7 @@ class Font:
...
@@ -65,7 +65,7 @@ class Font:
def
__init__
(
self
,
root
=
None
,
font
=
None
,
name
=
None
,
exists
=
False
,
**
options
):
def
__init__
(
self
,
root
=
None
,
font
=
None
,
name
=
None
,
exists
=
False
,
**
options
):
if
not
root
:
if
not
root
:
root
=
T
kinter
.
_default_root
root
=
t
kinter
.
_default_root
if
font
:
if
font
:
# get actual settings corresponding to the given font
# get actual settings corresponding to the given font
font
=
root
.
tk
.
splitlist
(
root
.
tk
.
call
(
"font"
,
"actual"
,
font
))
font
=
root
.
tk
.
splitlist
(
root
.
tk
.
call
(
"font"
,
"actual"
,
font
))
...
@@ -79,7 +79,7 @@ class Font:
...
@@ -79,7 +79,7 @@ class Font:
self
.
delete_font
=
False
self
.
delete_font
=
False
# confirm font exists
# confirm font exists
if
self
.
name
not
in
root
.
tk
.
call
(
"font"
,
"names"
):
if
self
.
name
not
in
root
.
tk
.
call
(
"font"
,
"names"
):
raise
T
kinter
.
_tkinter
.
TclError
,
"named font
%
s does not already exist"
%
(
self
.
name
,)
raise
t
kinter
.
_tkinter
.
TclError
,
"named font
%
s does not already exist"
%
(
self
.
name
,)
# if font config info supplied, apply it
# if font config info supplied, apply it
if
font
:
if
font
:
root
.
tk
.
call
(
"font"
,
"configure"
,
self
.
name
,
*
font
)
root
.
tk
.
call
(
"font"
,
"configure"
,
self
.
name
,
*
font
)
...
@@ -166,13 +166,13 @@ class Font:
...
@@ -166,13 +166,13 @@ class Font:
def
families
(
root
=
None
):
def
families
(
root
=
None
):
"Get font families (as a tuple)"
"Get font families (as a tuple)"
if
not
root
:
if
not
root
:
root
=
T
kinter
.
_default_root
root
=
t
kinter
.
_default_root
return
root
.
tk
.
splitlist
(
root
.
tk
.
call
(
"font"
,
"families"
))
return
root
.
tk
.
splitlist
(
root
.
tk
.
call
(
"font"
,
"families"
))
def
names
(
root
=
None
):
def
names
(
root
=
None
):
"Get names of defined fonts (as a tuple)"
"Get names of defined fonts (as a tuple)"
if
not
root
:
if
not
root
:
root
=
T
kinter
.
_default_root
root
=
t
kinter
.
_default_root
return
root
.
tk
.
splitlist
(
root
.
tk
.
call
(
"font"
,
"names"
))
return
root
.
tk
.
splitlist
(
root
.
tk
.
call
(
"font"
,
"names"
))
# --------------------------------------------------------------------
# --------------------------------------------------------------------
...
@@ -180,7 +180,7 @@ def names(root=None):
...
@@ -180,7 +180,7 @@ def names(root=None):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
root
=
T
kinter
.
Tk
()
root
=
t
kinter
.
Tk
()
# create a font
# create a font
f
=
Font
(
family
=
"times"
,
size
=
30
,
weight
=
NORMAL
)
f
=
Font
(
family
=
"times"
,
size
=
30
,
weight
=
NORMAL
)
...
@@ -202,10 +202,10 @@ if __name__ == "__main__":
...
@@ -202,10 +202,10 @@ if __name__ == "__main__":
f
=
Font
(
font
=
(
"Courier"
,
20
,
"bold"
))
f
=
Font
(
font
=
(
"Courier"
,
20
,
"bold"
))
print
f
.
measure
(
"hello"
),
f
.
metrics
(
"linespace"
)
print
f
.
measure
(
"hello"
),
f
.
metrics
(
"linespace"
)
w
=
T
kinter
.
Label
(
root
,
text
=
"Hello, world"
,
font
=
f
)
w
=
t
kinter
.
Label
(
root
,
text
=
"Hello, world"
,
font
=
f
)
w
.
pack
()
w
.
pack
()
w
=
T
kinter
.
Button
(
root
,
text
=
"Quit!"
,
command
=
root
.
destroy
)
w
=
t
kinter
.
Button
(
root
,
text
=
"Quit!"
,
command
=
root
.
destroy
)
w
.
pack
()
w
.
pack
()
fb
=
Font
(
font
=
w
[
"font"
])
.
copy
()
fb
=
Font
(
font
=
w
[
"font"
])
.
copy
()
...
@@ -213,4 +213,4 @@ if __name__ == "__main__":
...
@@ -213,4 +213,4 @@ if __name__ == "__main__":
w
.
config
(
font
=
fb
)
w
.
config
(
font
=
fb
)
T
kinter
.
mainloop
()
t
kinter
.
mainloop
()
Lib/
lib-tk/tkMessageB
ox.py
→
Lib/
tkinter/messageb
ox.py
Dosyayı görüntüle @
bbc57d73
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
# - type: dialog type; that is, which buttons to display (see below)
# - type: dialog type; that is, which buttons to display (see below)
#
#
from
tk
CommonD
ialog
import
Dialog
from
tk
inter.commond
ialog
import
Dialog
#
#
# constants
# constants
...
...
Lib/
lib-tk/ScrolledT
ext.py
→
Lib/
tkinter/scrolledt
ext.py
Dosyayı görüntüle @
bbc57d73
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
# Most methods calls are inherited from the Text widget; Pack methods
# Most methods calls are inherited from the Text widget; Pack methods
# are redirected to the Frame widget however.
# are redirected to the Frame widget however.
from
T
kinter
import
*
from
t
kinter
import
*
from
T
kinter
import
_cnfmerge
from
t
kinter
import
_cnfmerge
class
ScrolledText
(
Text
):
class
ScrolledText
(
Text
):
def
__init__
(
self
,
master
=
None
,
cnf
=
None
,
**
kw
):
def
__init__
(
self
,
master
=
None
,
cnf
=
None
,
**
kw
):
...
...
Lib/
lib-tk/SimpleD
ialog.py
→
Lib/
tkinter/simpled
ialog.py
Dosyayı görüntüle @
bbc57d73
"""A simple but flexible modal dialog box."""
"""A simple but flexible modal dialog box."""
from
T
kinter
import
*
from
t
kinter
import
*
class
SimpleDialog
:
class
SimpleDialog
:
...
...
Lib/
lib-tk/T
ix.py
→
Lib/
tkinter/t
ix.py
Dosyayı görüntüle @
bbc57d73
...
@@ -26,8 +26,8 @@
...
@@ -26,8 +26,8 @@
# appreciate the advantages.
# appreciate the advantages.
#
#
from
T
kinter
import
*
from
t
kinter
import
*
from
T
kinter
import
_flatten
,
_cnfmerge
,
_default_root
from
t
kinter
import
_flatten
,
_cnfmerge
,
_default_root
# WARNING - TkVersion is a limited precision floating point number
# WARNING - TkVersion is a limited precision floating point number
if
TkVersion
<
3.999
:
if
TkVersion
<
3.999
:
...
@@ -57,7 +57,7 @@ TCL_ALL_EVENTS = 0
...
@@ -57,7 +57,7 @@ TCL_ALL_EVENTS = 0
# BEWARE - this is implemented by copying some code from the Widget class
# BEWARE - this is implemented by copying some code from the Widget class
# in Tkinter (to override Widget initialization) and is therefore
# in Tkinter (to override Widget initialization) and is therefore
# liable to break.
# liable to break.
import
T
kinter
,
os
import
t
kinter
,
os
# Could probably add this to Tkinter.Misc
# Could probably add this to Tkinter.Misc
class
tixCommand
:
class
tixCommand
:
...
@@ -192,11 +192,11 @@ class tixCommand:
...
@@ -192,11 +192,11 @@ class tixCommand:
else
:
else
:
return
self
.
tk
.
call
(
'tix'
,
'resetoptions'
,
newScheme
,
newFontSet
)
return
self
.
tk
.
call
(
'tix'
,
'resetoptions'
,
newScheme
,
newFontSet
)
class
Tk
(
T
kinter
.
Tk
,
tixCommand
):
class
Tk
(
t
kinter
.
Tk
,
tixCommand
):
"""Toplevel widget of Tix which represents mostly the main window
"""Toplevel widget of Tix which represents mostly the main window
of an application. It has an associated Tcl interpreter."""
of an application. It has an associated Tcl interpreter."""
def
__init__
(
self
,
screenName
=
None
,
baseName
=
None
,
className
=
'Tix'
):
def
__init__
(
self
,
screenName
=
None
,
baseName
=
None
,
className
=
'Tix'
):
T
kinter
.
Tk
.
__init__
(
self
,
screenName
,
baseName
,
className
)
t
kinter
.
Tk
.
__init__
(
self
,
screenName
,
baseName
,
className
)
tixlib
=
os
.
environ
.
get
(
'TIX_LIBRARY'
)
tixlib
=
os
.
environ
.
get
(
'TIX_LIBRARY'
)
self
.
tk
.
eval
(
'global auto_path; lappend auto_path [file dir [info nameof]]'
)
self
.
tk
.
eval
(
'global auto_path; lappend auto_path [file dir [info nameof]]'
)
if
tixlib
is
not
None
:
if
tixlib
is
not
None
:
...
@@ -212,7 +212,7 @@ class Tk(Tkinter.Tk, tixCommand):
...
@@ -212,7 +212,7 @@ class Tk(Tkinter.Tk, tixCommand):
def
destroy
(
self
):
def
destroy
(
self
):
# For safety, remove an delete_window binding before destroy
# For safety, remove an delete_window binding before destroy
self
.
protocol
(
"WM_DELETE_WINDOW"
,
""
)
self
.
protocol
(
"WM_DELETE_WINDOW"
,
""
)
T
kinter
.
Tk
.
destroy
(
self
)
t
kinter
.
Tk
.
destroy
(
self
)
# The Tix 'tixForm' geometry manager
# The Tix 'tixForm' geometry manager
class
Form
:
class
Form
:
...
@@ -260,9 +260,9 @@ class Form:
...
@@ -260,9 +260,9 @@ class Form:
Tkinter
.
Widget
.
__bases__
=
T
kinter
.
Widget
.
__bases__
+
(
Form
,)
tkinter
.
Widget
.
__bases__
=
t
kinter
.
Widget
.
__bases__
+
(
Form
,)
class
TixWidget
(
T
kinter
.
Widget
):
class
TixWidget
(
t
kinter
.
Widget
):
"""A TixWidget class is used to package all (or most) Tix widgets.
"""A TixWidget class is used to package all (or most) Tix widgets.
Widget initialization is extended in two ways:
Widget initialization is extended in two ways:
...
@@ -383,7 +383,7 @@ class TixWidget(Tkinter.Widget):
...
@@ -383,7 +383,7 @@ class TixWidget(Tkinter.Widget):
# These are missing from Tkinter
# These are missing from Tkinter
def
image_create
(
self
,
imgtype
,
cnf
=
{},
master
=
None
,
**
kw
):
def
image_create
(
self
,
imgtype
,
cnf
=
{},
master
=
None
,
**
kw
):
if
not
master
:
if
not
master
:
master
=
T
kinter
.
_default_root
master
=
t
kinter
.
_default_root
if
not
master
:
if
not
master
:
raise
RuntimeError
,
'Too early to create image'
raise
RuntimeError
,
'Too early to create image'
if
kw
and
cnf
:
cnf
=
_cnfmerge
((
cnf
,
kw
))
if
kw
and
cnf
:
cnf
=
_cnfmerge
((
cnf
,
kw
))
...
...
Lib/
lib-tk
/turtle.py
→
Lib/
tkinter
/turtle.py
Dosyayı görüntüle @
bbc57d73
...
@@ -16,7 +16,7 @@ pictures can easily be drawn.
...
@@ -16,7 +16,7 @@ pictures can easily be drawn.
from
math
import
*
# Also for export
from
math
import
*
# Also for export
from
time
import
sleep
from
time
import
sleep
import
T
kinter
import
t
kinter
speeds
=
[
'fastest'
,
'fast'
,
'normal'
,
'slow'
,
'slowest'
]
speeds
=
[
'fastest'
,
'fast'
,
'normal'
,
'slow'
,
'slowest'
]
...
@@ -238,7 +238,7 @@ class RawPen:
...
@@ -238,7 +238,7 @@ class RawPen:
# Test the color first
# Test the color first
try
:
try
:
id
=
self
.
_canvas
.
create_line
(
0
,
0
,
0
,
0
,
fill
=
color
)
id
=
self
.
_canvas
.
create_line
(
0
,
0
,
0
,
0
,
fill
=
color
)
except
T
kinter
.
TclError
:
except
t
kinter
.
TclError
:
raise
Error
,
"bad color string:
%
r"
%
(
color
,)
raise
Error
,
"bad color string:
%
r"
%
(
color
,)
self
.
_set_color
(
color
)
self
.
_set_color
(
color
)
return
return
...
@@ -554,7 +554,7 @@ class RawPen:
...
@@ -554,7 +554,7 @@ class RawPen:
# in case nhops==0
# in case nhops==0
self
.
_canvas
.
coords
(
item
,
x0
,
y0
,
x1
,
y1
)
self
.
_canvas
.
coords
(
item
,
x0
,
y0
,
x1
,
y1
)
self
.
_canvas
.
itemconfigure
(
item
,
arrow
=
"none"
)
self
.
_canvas
.
itemconfigure
(
item
,
arrow
=
"none"
)
except
T
kinter
.
TclError
:
except
t
kinter
.
TclError
:
# Probably the window was closed!
# Probably the window was closed!
return
return
else
:
else
:
...
@@ -638,13 +638,13 @@ class Pen(RawPen):
...
@@ -638,13 +638,13 @@ class Pen(RawPen):
def
__init__
(
self
):
def
__init__
(
self
):
global
_root
,
_canvas
global
_root
,
_canvas
if
_root
is
None
:
if
_root
is
None
:
_root
=
T
kinter
.
Tk
()
_root
=
t
kinter
.
Tk
()
_root
.
wm_protocol
(
"WM_DELETE_WINDOW"
,
self
.
_destroy
)
_root
.
wm_protocol
(
"WM_DELETE_WINDOW"
,
self
.
_destroy
)
_root
.
title
(
_title
)
_root
.
title
(
_title
)
if
_canvas
is
None
:
if
_canvas
is
None
:
# XXX Should have scroll bars
# XXX Should have scroll bars
_canvas
=
T
kinter
.
Canvas
(
_root
,
background
=
"white"
)
_canvas
=
t
kinter
.
Canvas
(
_root
,
background
=
"white"
)
_canvas
.
pack
(
expand
=
1
,
fill
=
"both"
)
_canvas
.
pack
(
expand
=
1
,
fill
=
"both"
)
setup
(
width
=
_width
,
height
=
_height
,
startx
=
_startx
,
starty
=
_starty
)
setup
(
width
=
_width
,
height
=
_height
,
startx
=
_startx
,
starty
=
_starty
)
...
...
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