Re: tkinter: get filename of askopenfilename

2009-06-25 Thread norseman
rom wrote: Thanks again. After your replies, I have understood how to do what I wanted. What I wanted to do is to get a value after clicking a button and use it in another part of the program. As you said, after getting the value, I have to store it in a global variable. However, the program does

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread norseman
rom wrote: Ok. I think I got it. I have to do it in this way: ### import Tkinter import tkFileDialog filename='' root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=lambda: open_file_dialog()).pack() def open_file_dialog(): global filename

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread norseman
rom wrote: Thanks for your response. I have modified this minimal program as you suggested but still is not able to print the filename: ## import Tkinter import tkFileDialog global filename # NO NO NO! No global line here filename='' root = Tkinter.Tk() Tkinter.

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread rom
Thanks again. After your replies, I have understood how to do what I wanted. What I wanted to do is to get a value after clicking a button and use it in another part of the program. As you said, after getting the value, I have to store it in a global variable. However, the program does not do anyth

Re: tkinter: get filename of askopenfilename

2009-06-25 Thread Sean McIlroy
i think what he means is to put the global declaration inside the function that assigns to filename: def open_file_dialog(): global filename filename = tkFileDialog.askopenfilename(filetypes= [("allfiles","*")]) as it was, the function was creating a new variable called filename and assi

Re: tkinter: get filename of askopenfilename

2009-06-24 Thread rom
Ok. I think I got it. I have to do it in this way: ### import Tkinter import tkFileDialog filename='' root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=lambda: open_file_dialog()).pack() def open_file_dialog(): global filename filename = tk

Re: tkinter: get filename of askopenfilename

2009-06-24 Thread rom
Thanks for your response. I have modified this minimal program as you suggested but still is not able to print the filename: ## import Tkinter import tkFileDialog global filename filename='' root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=lambda: open

Re: tkinter: get filename of askopenfilename

2009-06-24 Thread norseman
OOPS - I left out the global statement rom wrote: Hi there, I am writing an interface with Tkinter. My minimal program looks like this: # import Tkinter import tkFileDialog # define globals here filename= '' # will take care of the problem root = Tkinter.Tk() Tkinter.Butto

Re: tkinter: get filename of askopenfilename

2009-06-24 Thread norseman
rom wrote: Hi there, I am writing an interface with Tkinter. My minimal program looks like this: # import Tkinter import tkFileDialog # define globals here filename= '' # will take care of the problem root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=la

tkinter: get filename of askopenfilename

2009-06-24 Thread rom
Hi there, I am writing an interface with Tkinter. My minimal program looks like this: # import Tkinter import tkFileDialog root = Tkinter.Tk() Tkinter.Button(root, text='Notch genes...', command=lambda: open_file_dialog()).pack() def open_file_dialog(): filename = tkFileDialog.a