Start New Discussion within our Software Development Community

Okay, Im not sure how to put this.
So here is my first try, and if it aint clear enough I'll try to explain better.

I have made a few scripts that work perfectly fine, but now my client prefers it to come with a GUI.
My script needs 2 variables [the file to open, and if it is a genbank or fasta file].
I want my GUI to use radiobuttons for the genbank/fasta choice, and this works fine. But I want the file to open with a askopenfilename() and I can't pass the filename on to my other script.

Could anyone explain how to do this?

from Tkinter import *
from tkFileDialog import askopenfilename
import unicodedata

root = Tk();

var = StringVar()
var.set("1")
naam = []

root.title('Bio-Inf Toolkit')  

def openfile():
    een = askopenfilename()
    twee = unicodedata.normalize("NFKD",een).encode("ascii","ignore")
    naam.insert(0,twee)



def doOne():
    return var.get()

def ClickToRun():
    #print var.get()
    naam2 = ','.join(str(n) for n in naam)
    print naam2
    return naam2


Label(root,text='Bio-Inf \n TOOLKIT').pack(pady=10)
Label(root, text="Klik op de knop om een file te kiezen ").pack(pady=10)
Button(root, text='Choose File', command=openfile) .pack(side=TOP)


Label(root, text="Wat voor een type file is het? ").pack(pady=10)
Radiobutton(root, text="GenBank", value="GenBank", variable=var, command = doOne).pack()
Radiobutton(root, text="Fasta", value="Fasta", variable=var, command = doOne).pack()

Button(root, text='ClickToRun', command=ClickToRun) .pack(side=BOTTOM)

root.mainloop()

print naam2
print var.get()
This question has already been answered. Start a new discussion instead.