Finaly found a simple enough task for python, took the plunge, but.....

vincent wehren vincent at visualtrans.de
Tue Jan 6 16:52:59 EST 2004


"Sam" <Sambo at connection.com> schrieb im Newsbeitrag
news:3FFB5312.1030803 at connection.com...
| Only 2 weeks messing around with it ( thanks to programs like SYNCHRONEX
and
| BITORRENT ), and already trying to create windows ( the paths are just too
long
| for me to want to type them ).
| After much trial and error I finaly got the following code to open the
'get dir'
| dialog , but I am getting another blank window titled 'tk' and "NOT
RESPONDING"
| When I kill it (end task), I get reiniit/restart (CTRL+F6) in my shell
window
| What am I doing wrong? Do I need to do anythink to clean up after using
the
| dialogs?

Take a look at the tkFileDialog module. Or better, use it for convenience.
It already provides some "standard" dialogs. You code would then look
similar to:
#-----------------------
import Tkinter
import tkFileDialog

def me():
    root = Tkinter.Tk()
    root.withdraw() # do this to remove the "blank screen" you mention
    dirname = tkFileDialog.askdirectory()
    return dirname

print me()
#------------------------

HTH

Vincent Wehren






|
|
****************************************************************************
******
| import os
| import sys
| import tkCommonDialog
|
| def me():
|    dir_name = ""
|
|    getfileDLG = tkCommonDialog.Dialog()
|    getfileDLG.command = "tk_chooseDirectory"
|    getfileDLG.__init__()
|    dir_name = getfileDLG.show( )
|
|    print dir_name
|
|
****************************************************************************
******
|
| The other think is that the dialog does not get focus.
|
| Must admit I was little more confortable with the HTML help in Python 2.3
| however less informative ( which I only installed a week before 2.3.3)
| The help server in 2.3.3 just produces blank pages (most of the time) and
| eventualy locks up. I think it has to do with the loopback, I read about
| somewhere, but I can't be dialed to my ISP all the time.
|
|
| Thanks, Sam.
|





More information about the Python-list mailing list