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
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
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.
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
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
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
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
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
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
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
10 matches
Mail list logo