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
bc0ad2d1
Commit
bc0ad2d1
authored
Nov 08, 2001
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge directory chooser into tkFileDialog.
parent
d5214b04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
54 deletions
+18
-54
Lib/lib-tk/tkDirectoryChooser.py
Lib/lib-tk/tkDirectoryChooser.py
+0
-52
Lib/lib-tk/tkFileDialog.py
Lib/lib-tk/tkFileDialog.py
+18
-2
No files found.
Lib/lib-tk/tkDirectoryChooser.py
deleted
100644 → 0
View file @
d5214b04
#
# tkDirectoryChooser.py
# $Id$
#
# tk common directory dialogue
#
# this module provides interfaces to the native directory dialogue
# available in Tk 8.3 and newer.
#
# written by Fredrik Lundh, November 2000.
#
#
# options (all have default values):
#
# - initialdir: initial directory. preserved by dialog instance.
#
# - mustexist: if true, user must pick an existing directory
#
# - parent: which window to place the dialog on top of
#
# - title: dialog title
#
from
tkCommonDialog
import
Dialog
class
Chooser
(
Dialog
):
command
=
"tk_chooseDirectory"
def
_fixresult
(
self
,
widget
,
result
):
if
result
:
# keep directory until next time
self
.
options
[
"initialdir"
]
=
result
self
.
directory
=
result
# compatibility
return
result
#
# convenience stuff
def
askdirectory
(
**
options
):
"Ask for a directory name"
return
apply
(
Chooser
,
(),
options
).
show
()
# --------------------------------------------------------------------
# test stuff
if
__name__
==
"__main__"
:
print
"directory"
,
askdirectory
()
Lib/lib-tk/tkFileDialog.py
View file @
bc0ad2d1
...
...
@@ -5,7 +5,8 @@
# tk common file dialogues
#
# this module provides interfaces to the native file dialogues
# available in Tk 4.2 and newer.
# available in Tk 4.2 and newer, and the directory dialogue available
# in Tk 8.3 and newer.
#
# written by Fredrik Lundh, May 1997.
#
...
...
@@ -28,6 +29,12 @@
#
# - title: dialog title
#
# options for the directory chooser:
#
# - initialdir, parent, title: see above
#
# - mustexist: if true, user must pick an existing directory
#
from
tkCommonDialog
import
Dialog
...
...
@@ -64,11 +71,20 @@ class SaveAs(_Dialog):
command
=
"tk_getSaveFile"
class
Directory
(
_Dialog
):
# the directory dialog has its own _fix routines.
class
Directory
(
Dialog
):
"Ask for a directory"
command
=
"tk_chooseDirectory"
def
_fixresult
(
self
,
widget
,
result
):
if
result
:
# keep directory until next time
self
.
options
[
"initialdir"
]
=
result
self
.
directory
=
result
# compatibility
return
result
#
# convenience stuff
...
...
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