Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Programming languages > file access dialog
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 23rd October 06:21
wouter@votinl wouter van ooijen
External User
 
Posts: 1
Default file access dialog



I have a tool in Python to which I want to add a small GUI. The tools
currently runs everywhere PySerial is supported. I need a file-access
dialog. What is the preffered way to to this? Is there a
platform-independent file-access dialog available, or should I use the
windows native version when running on windows (and how do I do that)?


Wouter van Ooijen

-- ------------------------------------
http://www.voti.nl
Webshop for PICs and other electronics
http://www.voti.nl/hvu
Teacher electronics and informatics
  Reply With Quote


  sponsored links


2 23rd October 06:22
adriaan renting
External User
 
Posts: 1
Default file access dialog



Well, I only know how to do it with Qt:
Dialog = QFileDialog(self.filedir, 'Python files (*.py)', self, 'open file dialog')
self.filename = str( Dialog.getOpenFileName())

I don't think PyQt is available for Qt4 on windows yet.
You might be ablt to use this:
http://www.quadgames.com/download/pythonqt/PyQtGPL10.exe

Tk or wxWindows, or the Windows API itself might also be possible, I have no experience with them. Using either Tk or wxWindows should give a portable application as well.


I have a tool in Python to which I want to add a small GUI. The tools
currently runs everywhere PySerial is supported. I need a file-access
dialog. What is the preffered way to to this? Is there a
platform-independent file-access dialog available, or should I use the
windows native version when running on windows (and how do I do that)?


Wouter van Ooijen

-- ------------------------------------
http://www.voti.nl
Webshop for PICs and other electronics
http://www.voti.nl/hvu
Teacher electronics and informatics
--
http://mail.python.org/mailman/listinfo/python-list
  Reply With Quote
3 24th October 08:56
eric brunel
External User
 
Posts: 1
Default file access dialog


Tkinter has a file acces dialog available with the same API on all platforms. It is also mapped to the standard dialog on Windows. Since Tkinter is certainly installed by default with Python, if a file dialog is everything you need, you probably don't have to look further.

To use the dialog, just do:

from Tkinter import Tk
from tkFileDialog import askopenfilename
## Tk needs a main window to work, so create one and hide it
root = Tk()
root.withdraw()
## Ask the file name
fileName = askopenfilename(filetypes=[('Python files', '*.py'), ('All files', '*')])
if fileName:
print 'open', fileName
else:
print 'cancelled'
## Over
root.destroy()

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])"
  Reply With Quote
4 24th October 08:57
fredrik lundh
External User
 
Posts: 1
Default file access dialog


depends on what GUI toolkit you prefer to use.

for Tkinter (which is available on most modern platforms), see "File
Dialogs" on this page:

http://www.pythonware.com/library/tkinter/introduction/x1164-data-entry.htm

the following thread may also be helpful: http://tinyurl.com/b2zxb
</F>
  Reply With Quote
5 24th October 09:11
utabintarbo
External User
 
Posts: 1
Default file access dialog


For simple, it's hard to beat EasyGUI: http://www.ferg.org/easygui/

Bob
  Reply With Quote
6 25th February 05:14
eric brunel
External User
 
Posts: 1
Default file access dialog


Tkinter has a file acces dialog available with the same API on all platforms. It is also mapped to the standard dialog on Windows. Since Tkinter is certainly installed by default with Python, if a file dialog is everything you need, you probably don't have to look further.

To use the dialog, just do:

from Tkinter import Tk
from tkFileDialog import askopenfilename
## Tk needs a main window to work, so create one and hide it
root = Tk()
root.withdraw()
## Ask the file name
fileName = askopenfilename(filetypes=[('Python files', '*.py'), ('All files', '*')])
if fileName:
print 'open', fileName
else:
print 'cancelled'
## Over
root.destroy()

HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])"
  Reply With Quote
7 25th February 05:14
fredrik lundh
External User
 
Posts: 1
Default file access dialog


depends on what GUI toolkit you prefer to use.

for Tkinter (which is available on most modern platforms), see "File
Dialogs" on this page:

http://www.pythonware.com/library/tkinter/introduction/x1164-data-entry.htm

the following thread may also be helpful: http://tinyurl.com/b2zxb
</F>
  Reply With Quote
8 26th February 05:42
utabintarbo
External User
 
Posts: 1
Default file access dialog


For simple, it's hard to beat EasyGUI: http://www.ferg.org/easygui/

Bob
  Reply With Quote
9 26th February 05:43
wouter@voti.nl (wouter van ooijen
External User
 
Posts: 1
Default file access dialog


Great


Wouter van Ooijen

-- ------------------------------------
http://www.voti.nl
Webshop for PICs and other electronics
http://www.voti.nl/hvu
Teacher electronics and informatics
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666