Fwd: Re: askopenfilename?????

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Wed Jul 10 11:33:33 EDT 2002


Whoops I sent to OP only (AGAIN!)

----------  Forwarded Message  ----------

Subject: Re: askopenfilename?????
Date: Wed, 10 Jul 2002 14:53:16 +0000
From: Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com>
To: jubafre at zipmail.com.br

On Wednesday 10 Jul 2002 1:49 pm, jubafre at zipmail.com.br wrote:
> i don´t know how to use a filetypes option of askopenfilename, somebody
> can help?
>
>
> askopenfilename(filetypes=???)

From the module comments:-

$ more /usr/local/lib/python2.2/lib-tk/tkFileDialog.py
#
# Instant Python
# $Id: tkFileDialog.py,v 1.4 2001/11/08 17:51:33 loewis Exp $
#
# tk common file dialogues
#
# this module provides interfaces to the native file dialogues
# available in Tk 4.2 and newer, and the directory dialogue available
# in Tk 8.3 and newer.
#
# written by Fredrik Lundh, May 1997.
#

#
# options (all have default values):
#
# - defaultextension: added to filename if not explicitly given
#
# - filetypes: sequence of (label, pattern) tuples.  the same pattern
#   may occur with several patterns.  use "*" as pattern to indicate
#   all files.
#

so for python file types..

filetypes=(('python source', '*.py'), ('compiled python', '*.pyc'))


interactive example.....


[bpse at m-franklin dev]$ python
Python 2.2.1 (#3, May 29 2002, 20:32:44)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> from Tkinter import *
>>> import tkFileDialog
>>> fil=tkFileDialog.askopenfilename(filetypes=(('python source', '*.py'),

('compiled python', '*.pyc')))





Cheers
Martin

-------------------------------------------------------

-- 
Martin Franklin
Initial Software Solutions
(44) (0)1293 556629 / (44) (0)1234 888960
mfranklin1 at gatwick.westerngeco.slb.com
Wed Jul 10 15:33:16 2002






More information about the Python-list mailing list