I encounter small issue with askopenfilename module in python. I create a small GUI for catch file, select and add option before running another script.
Presently i have define my GUI and i want to add button for call the askopenfilename.
But my problem is when i run my script askopenfilename start directly and not on click on my specific button.
I share with you my problematic code.
thanks for your help.
##Import##
import os
import sys
import math
import pickle
import shutil
import paramiko
import Tkinter, tkFileDialog
import Tix
from Tkinter import *
def open():
tkFileDialog.askopenfilename(initialdir="U:/calcul/projects/", title="job file selector",parent=fen1)
###Graphical interface##
#principal window
fen1=Tk()
fen1.title("utilitaire de lancement serveur")
v=IntVar()
tex=StringVar()
tex.set('abc \n timmy')
#slave widget
txt1=Label(fen1, text='Fichier Dat').grid(row=0, sticky=W)
entr1=Text(fen1, width=50,height=2).grid(row=1, sticky=W)
b1=Button(fen1, text='select file', command=open()).grid(row=2,sticky=E)
text2=Label(fen1, text='number of core').grid(row=3, sticky=W)
check1=Radiobutton(fen1, text="1 core", variable=v, value=1).grid(row=4, column=0)
check2=Radiobutton(fen1, text="8 core", variable=v, value=8).grid(row=5, column=0)
check3=Radiobutton(fen1, text="12 core", variable=v, value=12).grid(row=6, column=0)
text3=Label(fen1, text='Dependencies').grid(row=7, sticky=W)
entr2=Entry(fen1).grid(row=8, column=0)
text4=Label(fen1, text='log').grid(row=9, sticky=W)
mes1=Message(fen1,textvariable=tex,bg='white',relief='sunken',bd=3).grid(row=10, column=0)
b2=Button(fen1, text='quitter',command= fen1.quit).grid(row=11,column=1)
fen1.mainloop()
print v.get()