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
d5062bab
Kaydet (Commit)
d5062bab
authored
Şub 24, 2000
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Moshe Zadka:
Added docstrings to tkSimpleDialog.py
üst
48401121
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
4 deletions
+77
-4
tkSimpleDialog.py
Lib/lib-tk/tkSimpleDialog.py
+77
-4
No files found.
Lib/lib-tk/tkSimpleDialog.py
Dosyayı görüntüle @
d5062bab
...
@@ -11,13 +11,40 @@
...
@@ -11,13 +11,40 @@
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# dialog base class
# dialog base class
'''Dialog boxes
This module handles dialog boxes. It contains the following
public symbols:
Dialog -- a base class for dialogs
askinteger -- get an integer from the user
askfloat -- get a float from the user
askstring -- get a string from the user
'''
from
Tkinter
import
*
from
Tkinter
import
*
import
os
import
os
class
Dialog
(
Toplevel
):
class
Dialog
(
Toplevel
):
'''Class to open dialogs.
This class is intended as a base class for custom dialogs
'''
def
__init__
(
self
,
parent
,
title
=
None
):
def
__init__
(
self
,
parent
,
title
=
None
):
'''Initialize a dialog.
Arguments:
parent -- a parent window (the application window)
title -- the dialog title
'''
Toplevel
.
__init__
(
self
,
parent
)
Toplevel
.
__init__
(
self
,
parent
)
self
.
transient
(
parent
)
self
.
transient
(
parent
)
...
@@ -49,6 +76,7 @@ class Dialog(Toplevel):
...
@@ -49,6 +76,7 @@ class Dialog(Toplevel):
self
.
wait_window
(
self
)
self
.
wait_window
(
self
)
def
destroy
(
self
):
def
destroy
(
self
):
'''Destroy the window'''
self
.
initial_focus
=
None
self
.
initial_focus
=
None
Toplevel
.
destroy
(
self
)
Toplevel
.
destroy
(
self
)
...
@@ -56,14 +84,19 @@ class Dialog(Toplevel):
...
@@ -56,14 +84,19 @@ class Dialog(Toplevel):
# construction hooks
# construction hooks
def
body
(
self
,
master
):
def
body
(
self
,
master
):
# create dialog body. return widget that should have
'''create dialog body.
# initial focus. this method should be overridden
return widget that should have initial focus.
This method should be overridden, and is called
by the __init__ method.
'''
pass
pass
def
buttonbox
(
self
):
def
buttonbox
(
self
):
# add standard button box. override if you don't want the
'''add standard button box.
# standard buttons
override if you don't want the standard buttons
'''
box
=
Frame
(
self
)
box
=
Frame
(
self
)
...
@@ -103,10 +136,20 @@ class Dialog(Toplevel):
...
@@ -103,10 +136,20 @@ class Dialog(Toplevel):
# command hooks
# command hooks
def
validate
(
self
):
def
validate
(
self
):
'''validate the data
This method is called automatically to validate the data before the
dialog is destroyed. By default, it always validates OK.
'''
return
1
# override
return
1
# override
def
apply
(
self
):
def
apply
(
self
):
'''process the data
This method is called automatically to process the data, *after*
the dialog is destroyed. By default, it does nothing.
'''
pass
# override
pass
# override
...
@@ -196,6 +239,16 @@ class _QueryInteger(_QueryDialog):
...
@@ -196,6 +239,16 @@ class _QueryInteger(_QueryDialog):
return
string
.
atoi
(
self
.
entry
.
get
())
return
string
.
atoi
(
self
.
entry
.
get
())
def
askinteger
(
title
,
prompt
,
**
kw
):
def
askinteger
(
title
,
prompt
,
**
kw
):
'''get an integer from the user
Arguments:
title -- the dialog title
prompt -- the label text
**kw -- see SimpleDialog class
Return value is an integer
'''
d
=
apply
(
_QueryInteger
,
(
title
,
prompt
),
kw
)
d
=
apply
(
_QueryInteger
,
(
title
,
prompt
),
kw
)
return
d
.
result
return
d
.
result
...
@@ -205,6 +258,16 @@ class _QueryFloat(_QueryDialog):
...
@@ -205,6 +258,16 @@ class _QueryFloat(_QueryDialog):
return
string
.
atof
(
self
.
entry
.
get
())
return
string
.
atof
(
self
.
entry
.
get
())
def
askfloat
(
title
,
prompt
,
**
kw
):
def
askfloat
(
title
,
prompt
,
**
kw
):
'''get a float from the user
Arguments:
title -- the dialog title
prompt -- the label text
**kw -- see SimpleDialog class
Return value is a float
'''
d
=
apply
(
_QueryFloat
,
(
title
,
prompt
),
kw
)
d
=
apply
(
_QueryFloat
,
(
title
,
prompt
),
kw
)
return
d
.
result
return
d
.
result
...
@@ -213,6 +276,16 @@ class _QueryString(_QueryDialog):
...
@@ -213,6 +276,16 @@ class _QueryString(_QueryDialog):
return
self
.
entry
.
get
()
return
self
.
entry
.
get
()
def
askstring
(
title
,
prompt
,
**
kw
):
def
askstring
(
title
,
prompt
,
**
kw
):
'''get a string from the user
Arguments:
title -- the dialog title
prompt -- the label text
**kw -- see SimpleDialog class
Return value is a string
'''
d
=
apply
(
_QueryString
,
(
title
,
prompt
),
kw
)
d
=
apply
(
_QueryString
,
(
title
,
prompt
),
kw
)
return
d
.
result
return
d
.
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