Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
25ee87cc
Commit
25ee87cc
authored
Nov 07, 2001
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #478654: Expose tk_chooseDirectory.
Also delegate kw arguments through ** calls.
parent
c52d713b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
Lib/lib-tk/tkFileDialog.py
Lib/lib-tk/tkFileDialog.py
+11
-4
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/lib-tk/tkFileDialog.py
View file @
25ee87cc
...
...
@@ -64,6 +64,10 @@ class SaveAs(_Dialog):
command
=
"tk_getSaveFile"
class
Directory
(
_Dialog
):
"Ask for a directory"
command
=
"tk_chooseDirectory"
#
# convenience stuff
...
...
@@ -71,19 +75,19 @@ class SaveAs(_Dialog):
def
askopenfilename
(
**
options
):
"Ask for a filename to open"
return
apply
(
Open
,
(),
options
).
show
()
return
Open
(
**
options
).
show
()
def
asksaveasfilename
(
**
options
):
"Ask for a filename to save as"
return
apply
(
SaveAs
,
(),
options
).
show
()
return
SaveAs
(
**
options
).
show
()
# FIXME: are the following two perhaps a bit too convenient?
def
askopenfile
(
mode
=
"r"
,
**
options
):
"Ask for a filename to open, and returned the opened file"
filename
=
apply
(
Open
,
(),
options
).
show
()
filename
=
Open
(
**
options
).
show
()
if
filename
:
return
open
(
filename
,
mode
)
return
None
...
...
@@ -91,11 +95,14 @@ def askopenfile(mode = "r", **options):
def
asksaveasfile
(
mode
=
"w"
,
**
options
):
"Ask for a filename to save as, and returned the opened file"
filename
=
apply
(
SaveAs
,
(),
options
).
show
()
filename
=
SaveAs
(
**
options
).
show
()
if
filename
:
return
open
(
filename
,
mode
)
return
None
def
askdirectory
(
**
options
):
"Ask for a directory, and return the file name"
return
Directory
(
**
options
).
show
()
# --------------------------------------------------------------------
# test stuff
...
...
Misc/NEWS
View file @
25ee87cc
...
...
@@ -51,6 +51,9 @@ Extension modules
Library
- tkFileDialog exposes a Directory class and askdirectory
convenience function.
- Symbolic group names in regular expressions must be unique. For
example, the regexp r'(?P<abc>)(?P<abc>)' is not allowed, because a
single name can't mean both "group 1" and "group 2" simultaneously.
...
...
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