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
17f2b2df
Kaydet (Commit)
17f2b2df
authored
Tem 21, 1996
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Don't use tktools, dummy! Reworded test message slightly.
üst
421bb0e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
10 deletions
+62
-10
SimpleDialog.py
Lib/lib-tk/SimpleDialog.py
+31
-5
SimpleDialog.py
Lib/tkinter/SimpleDialog.py
+31
-5
No files found.
Lib/lib-tk/SimpleDialog.py
Dosyayı görüntüle @
17f2b2df
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
from
Tkinter
import
*
from
Tkinter
import
*
import
tktools
class
SimpleDialog
:
class
SimpleDialog
:
...
@@ -10,7 +9,13 @@ class SimpleDialog:
...
@@ -10,7 +9,13 @@ class SimpleDialog:
def
__init__
(
self
,
master
,
def
__init__
(
self
,
master
,
text
=
''
,
buttons
=
[],
default
=
None
,
cancel
=
None
,
text
=
''
,
buttons
=
[],
default
=
None
,
cancel
=
None
,
title
=
None
,
class_
=
None
):
title
=
None
,
class_
=
None
):
self
.
root
=
tktools
.
make_toplevel
(
master
,
title
=
title
,
class_
=
class_
)
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
=
Message
(
self
.
root
,
text
=
text
,
aspect
=
400
)
self
.
message
.
pack
(
expand
=
1
,
fill
=
BOTH
)
self
.
message
.
pack
(
expand
=
1
,
fill
=
BOTH
)
self
.
frame
=
Frame
(
self
.
root
)
self
.
frame
=
Frame
(
self
.
root
)
...
@@ -27,7 +32,28 @@ class SimpleDialog:
...
@@ -27,7 +32,28 @@ class SimpleDialog:
b
.
config
(
relief
=
RIDGE
,
borderwidth
=
8
)
b
.
config
(
relief
=
RIDGE
,
borderwidth
=
8
)
b
.
pack
(
side
=
LEFT
,
fill
=
BOTH
,
expand
=
1
)
b
.
pack
(
side
=
LEFT
,
fill
=
BOTH
,
expand
=
1
)
self
.
root
.
protocol
(
'WM_DELETE_WINDOW'
,
self
.
wm_delete_window
)
self
.
root
.
protocol
(
'WM_DELETE_WINDOW'
,
self
.
wm_delete_window
)
tktools
.
set_transient
(
self
.
root
,
master
)
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
widget
.
geometry
(
"+
%
d+
%
d"
%
(
x
,
y
))
widget
.
deiconify
()
# Become visible at the desired location
def
go
(
self
):
def
go
(
self
):
self
.
root
.
grab_set
()
self
.
root
.
grab_set
()
...
@@ -58,8 +84,8 @@ def test():
...
@@ -58,8 +84,8 @@ def test():
d
=
SimpleDialog
(
root
,
d
=
SimpleDialog
(
root
,
text
=
"This is a test dialog. "
text
=
"This is a test dialog. "
"Would this have been an actual dialog, "
"Would this have been an actual dialog, "
"the buttons below would have
glowed
"
"the buttons below would have
been glowing
"
"in soft pink light.
"
"in soft pink light.
\n
"
"Do you believe this?"
,
"Do you believe this?"
,
buttons
=
[
"Yes"
,
"No"
,
"Cancel"
],
buttons
=
[
"Yes"
,
"No"
,
"Cancel"
],
default
=
0
,
default
=
0
,
...
...
Lib/tkinter/SimpleDialog.py
Dosyayı görüntüle @
17f2b2df
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
from
Tkinter
import
*
from
Tkinter
import
*
import
tktools
class
SimpleDialog
:
class
SimpleDialog
:
...
@@ -10,7 +9,13 @@ class SimpleDialog:
...
@@ -10,7 +9,13 @@ class SimpleDialog:
def
__init__
(
self
,
master
,
def
__init__
(
self
,
master
,
text
=
''
,
buttons
=
[],
default
=
None
,
cancel
=
None
,
text
=
''
,
buttons
=
[],
default
=
None
,
cancel
=
None
,
title
=
None
,
class_
=
None
):
title
=
None
,
class_
=
None
):
self
.
root
=
tktools
.
make_toplevel
(
master
,
title
=
title
,
class_
=
class_
)
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
=
Message
(
self
.
root
,
text
=
text
,
aspect
=
400
)
self
.
message
.
pack
(
expand
=
1
,
fill
=
BOTH
)
self
.
message
.
pack
(
expand
=
1
,
fill
=
BOTH
)
self
.
frame
=
Frame
(
self
.
root
)
self
.
frame
=
Frame
(
self
.
root
)
...
@@ -27,7 +32,28 @@ class SimpleDialog:
...
@@ -27,7 +32,28 @@ class SimpleDialog:
b
.
config
(
relief
=
RIDGE
,
borderwidth
=
8
)
b
.
config
(
relief
=
RIDGE
,
borderwidth
=
8
)
b
.
pack
(
side
=
LEFT
,
fill
=
BOTH
,
expand
=
1
)
b
.
pack
(
side
=
LEFT
,
fill
=
BOTH
,
expand
=
1
)
self
.
root
.
protocol
(
'WM_DELETE_WINDOW'
,
self
.
wm_delete_window
)
self
.
root
.
protocol
(
'WM_DELETE_WINDOW'
,
self
.
wm_delete_window
)
tktools
.
set_transient
(
self
.
root
,
master
)
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
widget
.
geometry
(
"+
%
d+
%
d"
%
(
x
,
y
))
widget
.
deiconify
()
# Become visible at the desired location
def
go
(
self
):
def
go
(
self
):
self
.
root
.
grab_set
()
self
.
root
.
grab_set
()
...
@@ -58,8 +84,8 @@ def test():
...
@@ -58,8 +84,8 @@ def test():
d
=
SimpleDialog
(
root
,
d
=
SimpleDialog
(
root
,
text
=
"This is a test dialog. "
text
=
"This is a test dialog. "
"Would this have been an actual dialog, "
"Would this have been an actual dialog, "
"the buttons below would have
glowed
"
"the buttons below would have
been glowing
"
"in soft pink light.
"
"in soft pink light.
\n
"
"Do you believe this?"
,
"Do you believe this?"
,
buttons
=
[
"Yes"
,
"No"
,
"Cancel"
],
buttons
=
[
"Yes"
,
"No"
,
"Cancel"
],
default
=
0
,
default
=
0
,
...
...
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