Example #1
0
 def openFile(self):
     
     fileHandler = tkFileDialog.askopenfile(parent=self, mode='rb', title='Choose the first image')
     self.controller.clearCache()
     if fileHandler is not None:
         self.showImage(self.controller.loadImage(fileHandler))
         
         fileHandler2 = tkFileDialog.askopenfile(parent=self, mode='rb', title='Choose the second image')
         if fileHandler2 is not None:
             self.showImage(self.controller.loadImage(fileHandler2))
Example #2
0
 def findAsyPath(self):
   if sys.platform[:3] == 'win': #for windows, wince, win32, etc
     file=tkFileDialog.askopenfile(filetypes=[("Programs","*.exe"),("All files","*")],title="Find Asymptote Executable",parent=self)
   else:
     file=tkFileDialog.askopenfile(filetypes=[("All files","*")],title="Find Asymptote Executable",parent=self)
   if file != None:
     name = os.path.abspath(file.name)
     file.close()
     self.ap.delete(0,END)
     self.ap.insert(END,name)
     self.validate()
Example #3
0
 def findEEPath(self):
   if sys.platform[:3] == 'win': #for windows, wince, win32, etc
     file=tkFileDialog.askopenfile(filetypes=[("Programs","*.exe"),("All files","*")],title="Choose External Editor",parent=self)
   else:
     file=tkFileDialog.askopenfile(filetypes=[("All files","*")],title="Choose External Editor",parent=self)
   if file != None:
     name = os.path.abspath(file.name)
     file.close()
     self.ee.delete(0,END)
     self.ee.insert(END,name)
     self.validate()
Example #4
0
File: Prog10.py Project: mkds/MSDA
def http_plot():
    #Ask user for the file(s)
    file=tkFileDialog.askopenfile(initialfile='epa-http.txt',title='Select File',filetypes=[('all','*'), ('text','*.txt')])
    if file is None: return
    #Read file conente and replace =" with = so that we can parse the file properly
    filecontent=file.read().replace('="','=')

    #Create IO object for the cleansed data
    newfile=StringIO(filecontent)

    #Column Names for the data since the file don't have column names
    colnames=["host","date","request","httpcode","bytes"]

    #Parse the file into data frame
    df=pd.read_table(newfile,delim_whitespace=True,warn_bad_lines=True,names=colnames)

    #Create Hour Column from Date column
    df['hour']= df['date'].str.slice(4,6)
    #Create Day Column Date
    df['day']= df['date'].str.slice(1,3)

    #Plot number of request by
    pyplot.plot(df[['hour','request']].groupby(['hour'],as_index=False).count())
    pyplot.xlim((0,24))
    pyplot.title("Number of HTTP requests by hour")
    pyplot.xlabel("Hour")
    pyplot.ylabel("Number of HTTP Requests")
    pyplot.show()
Example #5
0
 def openFile(self):
     f = tkFileDialog.askopenfile(mode='r', defaultextension=".prf")
     if f is None:
         return
     lines = f.readlines()
     numL = []
     stepL = []
     ruleL = []
     refL = []
     prev = ""
     for l in lines:
         elem = l.split('\t')
         if (prev == "proof\n"):
             self.master.title(l)
         if (len(elem) == 4):
             numL.append(elem[0])
             stepL.append(elem[1])
             ruleL.append(elem[2])
             refL.append(elem[3])
         prev = l
     for i in range(0,len(numL)):
         self.addLine(self.step)
         lastS = self.stepNumber[len(self.stepNumber) - 1]
         lastSen = self.sentence[len(self.sentence) - 1]
         lastRef = self.reference[len(self.reference) - 1]
         l = ProofLine(lastS.cget("text"), lastSen.get("1.0",END), lastRef.cget("text"), "sad", "dsa")
         lines.append(l)        
         self.step += 30
     for i in range(0,len(numL)):
         self.sentence[i].insert("insert", stepL[i])
     f.close()
 def openFile(self):
     f = tkFileDialog.askopenfile(mode='r', parent=self, title="Open a file...")
     if f is not None:
         lines = f.readlines()
         self.loadData(lines)
         self.enableRunning()
         f.close()
Example #7
0
def run():
	Tk().withdraw() #dont need a console open
	if sys.version_info[0] < 3:
		zippath = tkFileDialog.askopenfile() #open up the file system and get the name
	else:
		zippath = filedialog.askopenfile()
	clean(zippath.name)
Example #8
0
    def file_open(self):
        f = filedialog.askopenfile( filetypes =((".bon files", "*.bon"), ("All files", "*.*")))
        if f is None: return

        passedEndAssets = False
        passedEndLiabs = False

        self.nameEntry.delete(0, END)  # delete the current name
        self.nameEntry.insert(0, f.readline().strip() ) # insert new name from file

        self.albox.delete(0, END) #delete asset box contents
        self.llbox.delete(0, END) #delete liability box contents

        self.reportText.config( state='normal' ) #enable changes for text
        self.reportText.delete( '1.0', END ) #delete text

        for line in f:
            if line == '<jksd8y9uh8yhjgidf7>\n':
                passedEndAssets = True
                continue
            if line == '<98a98fja489h7wf89>\n':
                passedEndLiabs = True
                continue
            if passedEndLiabs: #in reportText
                self.reportText.insert( END, line )
            elif passedEndAssets and line != '\n': #in liabs
                line = line.rstrip()
                self.llbox.insert( END, line )
            elif line != '\n': #in assets
                line = line.rstrip()
                self.albox.insert( END, line )
        self.reportText.config( state='disabled' ) #diable text changes
Example #9
0
    def load(self):
        myFormats = [
                     ('Vectors Graph','*.vgr'),
                     ]

        file = tkFileDialog.askopenfile(parent=self.root,mode='rb',filetypes=myFormats, title='Choose a file')      
        if file == None:
            return
        data = file.read()
        file.close()
        self.vertices = [] 
        self.pastVertices = [] 
        self.edges = [] 
        lines = data.split()
        for line in lines:
            c = line[0]
            if c == '#':
                continue
            line = line[1:]
            pairs = line.split('|')
            if c == 'E':
                for pair in pairs: 
                    self.edges.append(str2intPair(pair))
            if c == 'V':
                for pair in pairs: 
                    self.vertices.append(str2floatPair(pair))
                    self.pastVertices += [[]]
            self.refresh()
def loadfile():
    global kids
    loadedfile=tkFileDialog.askopenfile(mode='r', filetypes=[("Text files","*.ssc")])
    try:
        kids=loadedfile.read().split(",")
    except AttributeError:
        tkMessageBox.showinfo("No file selected", "You need to select a file")
def main():
    root = Tkinter.Tk()
    root.withdraw()

    inFile = tkFileDialog.askopenfile(parent=root,mode='rb',filetypes=formats,title='Choose the CADCAM input file')

    if inFile == None:
        doExit("No file chosen!")

    if not "CADCAM" in inFile.name:
        doExit('Input filename does not contain CADCAM, is this an ARES output file?')

    outFile = re.sub('CADCAM.ZIP$', 'OSHPark.ZIP', inFile.name)

    source = ZipFile(inFile, 'r')
    target = ZipFile(outFile, 'w')
    for file in source.filelist:
        renamed = mapFilename(file.filename)
        if renamed:
            target.writestr(renamed, source.read(file))
    target.close()
    source.close()

    print
    doExit('Files renamed and added to output file: ' + outFile)
Example #12
0
def getsituation():
    global root
    if not root:
        # The following arcane sequence ensures that the file dialog box
        #   will appear in front of all other windows.
        root = Tk() # invoke Tk (graphics toolkit)
        root.wm_geometry(newGeometry='+0+0')
    else:
        root.deiconify()
    root.wait_visibility() # wait for root window to be displayed
    root.focus_force() # force it to be in focus (in front of all other windows)
    fd = tkFileDialog.askopenfile(filetypes=filetypes)
    root.withdraw() # make root window invisible
    if not fd:
        return
    data = fd.read()
    words = string.split(data)
    # File format: three sets of 7 numbers;
    # x, y, z, vx, vy, vz, mass
    for nn in range(3):
        base = 7*nn
        stars[nn].pos = vector(float(words[base+0]),float(words[base+1]),float(words[base+2]))
        stars[nn].vel = vector(float(words[base+3]),float(words[base+4]),float(words[base+5]))
        stars[nn].mass = float(words[base+6])
    for s in stars:
        s.trail.pos = []
        s.p = s.mass*s.vel
    showvarrs()
    bget.state = 1
    restoreview()
def choose():
    "This Function selects the file to be analyzed"
    root = Tk()
    root.update()
    m = tkFileDialog.askopenfile(parent=root,mode='rb',title='Choose File')
    root.destroy()
    return m
Example #14
0
 def ReadParametersFromFile(self):
     #Ask for a file to load
     file = tkFileDialog.askopenfile(parent=None, initialdir='./')
     newParameters = []
     for line in file:
         newParameters.append(line.rstrip())
     self.PopulateFormFields(newParameters)
 def selectXML(self):
     self.cleanTextbox()
     
     filetypes = [('XML file','*.xml')]
     file = tkFileDialog.askopenfile(parent=self, mode='rb', title='Choose a file', filetypes=filetypes, initialdir=DCP_FOLDER)
     if file != None:
         self.processXML(file.name)
Example #16
0
File: Prog10.py Project: mkds/MSDA
def regression_plot():
    file = tkFileDialog.askopenfile(initialfile='brainandbody.csv',title='Select File',filetypes=[('all','*'), ('csv','*.csv')]) # Ask user for the file and open the file in read mode
    if file is None: return
    # Read Input, split input into lines, split fields in a line to a list and store as nested list
    brainandbody = [lines.split(",") for lines in file.read().splitlines()][1:]

    # Compute regression formula
    brainandbody_n=numpy.array([[body,brain] for name,body,brain in brainandbody],float)
    coeff,covar=curve_fit(lm,brainandbody_n[:,1],brainandbody_n[:,0])


    brain=[float(br) for name,bo,br in brainandbody]
    actual_body=[float(bo) for name,bo,br in brainandbody]
    linear_body=[lm(br,coeff[0],coeff[1]) for br in brain]





    #Plot the data, linear and quadratic models
    dat,=pyplot.plot(brain,actual_body,"go",label="Data")
    linear_line,=pyplot.plot(brain,linear_body,"b-",label="Linear Regression")
    pyplot.legend(handles=[dat,linear_line],loc=2)
    pyplot.title("Data and Linear Fit")
    pyplot.xlabel("Brain weight")
    pyplot.ylabel("Body Weight")
    pyplot.show()
 def _getReadAuthenticationFile(self):
     # open authentication file
     authFile = tkFileDialog.askopenfile(
                     mode        ='r',
                     title       = 'Select an LBR authentication file',
                     multiple    = False,
                     initialfile = 'guest.lbrauth',
                     filetypes = [
                                     ("LBR authentication file", "*.lbrauth"),
                                     ("All types", "*.*"),
                                 ]
                 )
     # parse authentication file
     connectParams = {}
     for line in authFile:
         match = re.search('(.*) = (.*)',line)
         if match!=None:
             key = match.group(1).strip()
             val = match.group(2).strip()
             try:
                 connectParams[key] = int(val)
             except ValueError:
                 connectParams[key] =     val
     
     # return the parameters I've found in the file
     return connectParams
def chooseFileDialog():
    global isopen
    global possition
    
    #using the tkFileDialog to open a file via a gui
    file = tkFileDialog.askopenfile(parent = win, mode = 'rb', title='select a file')

    if file != None:
        currentName = file
        #Extracting the possition and the gripper data from the file
        newpos = int(file.readline().strip())
        gripper = int(file.readline().strip())
        print("new pos",newpos,"   gripper",gripper)
        flag = False
        pos1 = newpos
        #Adjusting the robot possition to the new possition
        while pos1 != possition:
            if pos1 < possition:
                downArm()
                possition -=1
                print(possition, " going down")
            if pos1 > possition:
                upArm()
                possition +=1
                print(possition, "going up")
                
        #Changing the gripper status if need be
        if gripper == 1 and isopen == False:
            OpenClaw()
        elif gripper == 0 and isopen == True:
            CloseClaw()
Example #19
0
 def CreateWidgets(self):
     """Create all the widgets that we need"""
             
     """Create the Text"""
     self.lbText = Label(self, text="Plan de materias:")
     self.lbText.grid(row=0, column=0)
     
     """Create the Entry, set it to be a bit wider"""
     self.enText = Entry(self)
     self.enText.grid(row=0, column=1, columnspan=3)
     
     #~ self.boton0 = Button(self, text="Abrir...", command=
     
     self.browse0 = tkFileDialog.askopenfile(parent=self,mode="r",title="Seleccionar plan de materias...")
     
     self.lbText1 = Label(self, text="Tu nombre:")
     self.lbText1.grid(row=1, column=0)
     
     self.enText1 = Entry(self)
     self.enText1.grid(row=1, column=1, columnspan=3)
     
     """Create the Button, set the text and the 
     command that will be called when the button is clicked"""
     self.btnDisplay = Button(self, text="Display!", command=self.Display)
     self.btnDisplay.grid(row=2, column=2)
Example #20
0
 def choose_file(self):
     file = tkFileDialog.askopenfile(parent=root,
     initialdir="./lifeforms", mode='rb',title='Choose file to load')
     temp = file.name
     temp1 = temp.split('/')
     filename = temp1[-1]
     self.lifeform.set(filename) #IGNORE:W0622
Example #21
0
def plot_cars():

    car_file = tkFileDialog.askopenfile(title='Please select cars.data.csv',
                                        filetypes=[('CSV files', '.csv')])
    is_empty_quit(car_file)
    cars = pd.read_csv(car_file, names=('buying', 'maint', 'doors', 'persons',
                                       'lug_boot', 'safety', 'dropme'),
                       header=None)
    cars = cars[cars.columns[:-1]]  # don't even remember what last col represents

    # getting data into numerical datatypes
    # next line works bc these columns are already sorted in desc order
    for val, num in zip(cars.buying.unique(), xrange(4, 0, -1)):
        cars[['buying', 'maint']] = cars[['buying', 'maint']].replace(val, num)

    # next line works bc this column is already sorted in asc order
    for val, num in zip(cars.safety.unique(), xrange(1, 4)):
        cars['safety'] = cars['safety'].replace(val, num)

    # doors not numeric
    cars['doors'] = cars['doors'].replace('5more', 5).astype('int64')

    cols = ('buying', 'maint', 'safety', 'doors')
    fig, ((p0, p1), (p2, p3)) = plt.subplots(2, 2)
    plots = {c: p for c, p in zip(cols, (p0, p1, p2, p3))}
    for col in cols:
        plots[col].hist(list(cars[col]), bins=len(cars[col].unique()),
                        histtype='stepfilled')
        plots[col].set_title(col)
    plt.show()
Example #22
0
def open_command():
        file = tkFileDialog.askopenfile(parent=window,mode='rb',title='Select a file')
        if file != None:
            text = file.read()
            txt.insert(END, text)
            print file
            file.close()	
Example #23
0
    def __init__(self):
        data_dir = user_data_dir('sky3ds', 'Aperture Laboratories')
        template_txt = os.path.join(data_dir, 'template.txt')

        file_name = tkFileDialog.askopenfile( initialdir = os.path.expanduser('~/Desktop'), filetypes=[ ("Text files","*.txt")] )

        if file_name:
            try:
                new_template = file_name.read()
                write_template = open(template_txt, 'w')
                write_template.write(new_template)

                file_name.close()
                write_template.close()

                tkMessageBox.showinfo("Template Updated", "Template.txt updated successfully")

            except:
                raise Exception("Template.txt could not be updated")

            try:
                titles.convert_template_to_json()
            except:
                raise Exception("Template.txt could not converted to JSON. Please verify that your template.txt is not corrupt.")
        else:
            return
Example #24
0
 def handleOpen(self,event=None):
     print 'handleOpen'
     fobj = tkFileDialog.askopenfile( parent=self.root, mode='rU', title='Choose a data file' )
     import readfile
     self.data=readfile.toList(fobj)
     self.plotData()
     return
Example #25
0
 def pick_file(self):
     file = tkFileDialog.askopenfile(title="pick a file!")
     if file is not None:
         entry = tk.Entry(self)
         entry.insert(0, file.name)
         entry.grid(in_=self.entry_frame, sticky="ew")
         self.button.configure(text="Pick another file!")
 def openWallet(self):
     file = tkFileDialog.askopenfile(parent=self.root, initialdir="./.coins", mode='rb', title='SCPP Coins')
     if file != None:
         data = file.read()
         file.close()
         #print "I got %d bytes from this file." % len(data)
         tkMessageBox.showinfo("SCPP  Coin Scrypt", data)
Example #27
0
def ImportCSV():
    global pairs, IsOrdered
    file = tkFileDialog.askopenfile(filetypes=(("CSV Table", "*.csv"), ("All files", "*.*")))
    pairs = ParseInput(file)
    IsOrdered = False
    if pairs != None:
        tkMessageBox.showinfo("EventingApp.Message", "Success! Table has been imported!")
Example #28
0
    def loadPickledEvents(self):
        '''
        Loads a pickled list of all known events from a given file.

        Parameters: None

        Returns: Nothing

        Raises: ???
        '''
        #get the file containing the pickled cache from the user
        temp_file = askopenfile('r')
        #create a temporary dictionary with the cache
        t_cache = pickle.load(temp_file)
        #cleanup
        temp_file.close()
        
        #wipe out all of the old events
        self.clearEvents()

        #fill the cache again
        self.outputEventMap.update(t_cache)
        
        #populate the GUI with the events
        for key in self.outputEventMap.keys():
            self.ebST.insert('end', key)

        return
def upload():
    global uploadPath
    global uploadCounter
    uploadPath = tkFileDialog.askopenfile()
    root = ET.parse(uploadPath)
    getElementText("softwareversion",root)
    getElementText("domain",root)
    getElementText("browserpath",root)
    getElementText("browserfilename",root)
    getElementText("commserverpath",root)
    getElementText("commserverfilename",root)
    getElementText("detectorfilereference",root)
    getElementText("cpuid",root)
    getElementText("ipaddress",root)
    getElementText("oplogfilename",root)
    i = 0
    uploadCounter = 0
    putTextInEntry(0)
    putTextInEntry(1)
    putTextInEntry(2)
    putTextInEntry(3)
    putTextInEntry(4)
    putTextInEntry(5)
    putTextInEntry(6)
    putTextInEntry(7)
Example #30
0
def obtener_archivo():
    tipo = [
    ('texto','*.txt')]

    import Tkinter,tkFileDialog

    root = Tkinter.Tk()
    root.withdraw()

    file = tkFileDialog.askopenfile(parent=root,mode='rb',filetypes = tipo, title='Elige parrilla de origen')
    if file != None:

        archivo = file.name



    myFormats = [
    ('texto','*.txt')]


    root = Tkinter.Tk()
    root.withdraw()
    nombre_nuevo = tkFileDialog.asksaveasfilename(parent=root,filetypes=myFormats ,title="Introduce la fecha de la nueva parrilla (yyyy-mm-dd)")
    if len(nombre_nuevo ) > 0:

        escribir_tabla_2.avanzar_dia(archivo, nombre_nuevo)
Example #31
0
def open_command():
        file = tkFileDialog.askopenfile(parent=window,mode='rb',title='Select a file')
        if file != None:
            text = file.read()
            txt.insert(END, text)
            file.close()	
Example #32
0
	def openFileDialog(self):
		return tkFileDialog.askopenfile(mode='r')
Example #33
0
    def onLoadJsonFileButton(self):
        file_path = tkFileDialog.askopenfile(**{})

        if file_path:
            self.json_reader.configure(path=file_path.name)
            self.json_reader.start()
Example #34
0
 def GetSource(self):
     global fp
     fp = tkFileDialog.askopenfile()
Example #35
0
 def open_file(self, event=''):
     open_file = tkFileDialog.askopenfile(mode='r', **self.file_opt)
     self.text_box.delete(1.0, END)
     self.text_box.insert(END, open_file.read())
     self.file_name = open_file.name
     print self.file_name
Example #36
0
def open_file():
    file = tkFileDialog.askopenfile(parent=root, mode='rb', title='Select a file',defaultextension=".txt",filetypes=[("All Files","*.*"),("Text Document","*.txt"),("HTML","*.html")])
    if file != None:
        contents = file.read()
        textPad.insert('1.0', contents)
        file.close()
 def OnButtonClick(self):
     target = str(tkFileDialog.askopenfile(title='Open Manga List Location'))
     directory = re.compile("<open file u'(.*)', mode 'r' at \dx\d+>")
     Address = ''.join(re.findall(directory,target))
     self.Location.delete(0,END)
     self.Location.insert(0,Address)
Example #38
0
def bro():
    file = tkFileDialog.askopenfile(parent=root,
                                    mode='rb',
                                    title='Choose a file')
    e.set(file.name)
Example #39
0
def load_iso2flux_model(project_file="project.iso2flux",
                        sbml_name="project_metabolic_model.sbml",
                        ask_sbml_name=False,
                        gui=False):
    if gui:
        tk = Tkinter.Tk()
        tk.withdraw()
        loaded_file = tkFileDialog.askopenfile(title='Select iso2flux file',
                                               filetypes=[("iso2flux",
                                                           ".iso2flux")])
        project_file = loaded_file.name
        if ask_sbml_name == True:
            loaded_file = tkFileDialog.askopenfile(
                title='Select reference SBML model',
                filetypes=[("sbml", ".sbml"), ("xml", ".xml")])
            sbml_name = loaded_file.name
        tk.destroy()
    if ask_sbml_name == False:
        sbml_name = project_file[:-9] + "_iso2flux.sbml"
    metabolic_model = cobra.io.read_sbml_model(sbml_name)
    with open(project_file, 'r') as fp:
        project_dict = json.load(fp)
    loaded_label_model = Label_model(metabolic_model)
    loaded_label_model.constrained_model = copy.deepcopy(metabolic_model)
    loaded_label_model.eqn_dir = project_dict[
        "eqn_dir"]  #project_dict["eqn_dir"]
    loaded_label_model.reaction_n_dict = project_dict["reaction_n_dict"]
    loaded_label_model.merged_reactions_reactions_dict = project_dict[
        "merged_reactions_reactions_dict"]
    loaded_label_model.force_balance = project_dict["force_balance"]
    loaded_label_model.ratio_dict = project_dict["ratio_dict"]
    loaded_label_model.parameter_dict = project_dict["parameter_dict"]
    loaded_label_model.turnover_flux_dict = project_dict["turnover_flux_dict"]
    size_variable_dict = project_dict["size_variable_dict"]
    #convert indices back to int and generate size_inverse_variable_dict
    loaded_label_model.size_inverse_variable_dict = {}
    loaded_label_model.size_variable_dict = {}
    for size in size_variable_dict:
        int_size = int(size)
        loaded_label_model.size_variable_dict[int_size] = size_variable_dict[
            size]
        loaded_label_model.size_inverse_variable_dict[int_size] = {}
        for mi in size_variable_dict[size]:
            n = size_variable_dict[size][mi]
            loaded_label_model.size_inverse_variable_dict[int_size][n] = mi

    emu_dict = project_dict["emu_dict"]
    loaded_label_model.emu_dict = copy.deepcopy(emu_dict)
    #convert indices back to int
    for emu in emu_dict:
        for n in emu_dict[emu]["mid"]:
            loaded_label_model.emu_dict[emu]["mid"][int(
                n)] = emu_dict[emu]["mid"][n]
    #
    loaded_label_model.rsm_list = project_dict["rsm_list"]
    emu_size_dict = project_dict["emu_size_dict"]
    #convert indices back to int
    loaded_label_model.emu_size_dict = {}
    for size in emu_size_dict:
        int_size = int(size)
        loaded_label_model.emu_size_dict[int_size] = emu_size_dict[size]
    #
    loaded_label_model.initial_label = project_dict["initial_label"]
    experimental_dict = project_dict["experimental_dict"]
    #convert string back to int
    loaded_label_model.experimental_dict = {}
    for condition in experimental_dict:
        loaded_label_model.experimental_dict[condition] = {}
        for emu in experimental_dict[condition]:
            loaded_label_model.experimental_dict[condition][emu] = {}
            for n in experimental_dict[condition][emu]:
                loaded_label_model.experimental_dict[condition][emu][int(
                    n)] = experimental_dict[condition][emu][n]
    loaded_label_model.input_m0_list = project_dict["input_m0_list"]
    loaded_label_model.input_n_dict = project_dict["input_n_dict"]
    loaded_label_model.data_name_emu_dict = project_dict["data_name_emu_dict"]
    loaded_label_model.lp_tolerance_feasibility = project_dict[
        "lp_tolerance_feasibility"]
    loaded_label_model.parameter_precision = project_dict[
        "parameter_precision"]
    loaded_label_model.metabolite_id_isotopomer_id_dict = project_dict[
        "metabolite_id_isotopomer_id_dict"]
    loaded_label_model.isotopomer_id_metabolite_id_dict = project_dict[
        "isotopomer_id_metabolite_id_dict"]
    loaded_label_model.reactions_propagating_label = project_dict[
        "reactions_propagating_label"]
    loaded_label_model.project_dict = project_dict[
        "reactions_propagating_label"]
    loaded_label_model.project_dict = project_dict[
        "label_groups_reactions_dict"]
    loaded_label_model.p_dict = project_dict["p_dict"]
    loaded_label_model.best_label_variables = project_dict.get(
        "best_label_variables")  #None if not present
    loaded_label_model.best_p13cmfa_variables = project_dict.get(
        "best_p13cmfa_variables")  #None if not present
    #############################3
    loaded_label_model.flux_solver_free_fluxes = np.array(
        project_dict["flux_solver_free_fluxes"])
    temp_flux_solver_independent_flux_dict = project_dict[
        "flux_solver_independent_flux_dict"]
    flux_solver_independent_flux_dict = {}
    for n in temp_flux_solver_independent_flux_dict:
        flux_solver_independent_flux_dict[int(
            n)] = temp_flux_solver_independent_flux_dict[n]
    loaded_label_model.flux_solver_independent_flux_dict = flux_solver_independent_flux_dict

    temp_flux_solver_n_reaction_dict = project_dict[
        "flux_solver_n_reaction_dict"]
    flux_solver_n_reaction_dict = {}
    for n in temp_flux_solver_n_reaction_dict:
        flux_solver_n_reaction_dict[int(
            n)] = temp_flux_solver_n_reaction_dict[n]
    loaded_label_model.flux_solver_n_reaction_dict = flux_solver_n_reaction_dict
    loaded_label_model.flux_solver_reaction_n_dict = project_dict[
        "flux_solver_reaction_n_dict"]
    loaded_label_model.variable_list_dict = project_dict["variable_list_dict"]
    loaded_label_model.variable_vector = np.array(
        project_dict["variable_vector"])
    loaded_label_model.flux_solver_nullmnp = np.loadtxt(project_file[:-9] +
                                                        "_nullmatrix.txt")
    loaded_label_model.label_tolerance = project_dict["label_tolerance"]
    loaded_label_model.best_flux = project_dict.get("best_flux")
    loaded_label_model.best_chi2 = project_dict.get("best_chi2")
    ##############################
    set_equations_variables(loaded_label_model,
                            force_balance=loaded_label_model.force_balance)
    sys.path.insert(0, loaded_label_model.eqn_dir)
    from get_equations import get_equations
    #exec("from " + loaded_label_model.eqn_dir+".get_equations import get_equations")
    loaded_label_model.size_emu_c_eqn_dict = {}
    get_equations(loaded_label_model.size_emu_c_eqn_dict)
    del loaded_label_model.irreversible_metabolic_model  #Delete irreversible model as it not used if the model is already built
    loaded_label_model.project_name = project_file.split("/")[-1]
    if loaded_label_model.parameter_dict != {}:
        apply_parameters(loaded_label_model, loaded_label_model.parameter_dict)
    apply_ratios(loaded_label_model.constrained_model,
                 loaded_label_model.ratio_dict)
    loaded_label_model.compute_fluxes = get_compute_fluxes_function(
        loaded_label_model)
    return loaded_label_model
# 文件夹可以使用的选项
# initialdir, parent, title
# mustexist: 必须选择已存在的文件夹

# 函数列表

# 询问文件夹对话框
# askdirectory(**options)
if 0:
    dir_name = tkFileDialog.askdirectory()
    print(u"目录: {}".format(dir_name))

# 询问一个文件并打开返回文件对象
# askopenfile(mode='r', **options)
if 0:
    file_content = tkFileDialog.askopenfile()
    print(len(file_content.read()))

# 询问文件名
# askopenfilename(**options)
if 0:
    file_name = tkFileDialog.askopenfilename()
    print(file_name)

# 询问文件名列表 多选
# askopenfilenames(**options)
if 0:
    file_list = tkFileDialog.askopenfilenames()
    print(file_list)

# 询问文件名列表 返回文件对象列表
Example #41
0
 def setPath(self):
     path = tkFileDialog.askopenfile(filetypes=[('Initialization File',
                                                 '.ini')])
     return path
'''
Created on Aug 8, 2014

@author: Marc
'''

import Tkinter
import tkMessageBox
import tkFileDialog
import tkColorChooser

tkMessageBox.showinfo(title='A Friendly Message', message="Hello, Tkinter!")
# showinfo(), showwarning(), and showerror() are the three types of messagebox
tkMessageBox.askyesno(title="Hungry?", message='Do you want SPAM?')
# Messagebox Types: Questions askyesno(), askokcancel(), askretrycancel(), askyesnocancel(), askquestion()
filename = tkFileDialog.askopenfile()
print filename.name
# tkFileDialog types: askopenfile(mode), askopenfiles(mode), askopenfilename(), askopenfilenames()
print tkColorChooser.askcolor(initialcolor='#FFFFFF')
Example #43
0
    def askopenfile(self):
        """Returns an opened file in read mode."""

        return tkFileDialog.askopenfile(mode='r', **self.file_opt)
Example #44
0
def open_command():
	file = tkFileDialog.askopenfile(parent=root,mode='rb',title='Select a File')
	if file != None:
		contents=file.read()
		textPad.insert('1.0', contents)
		file.close()
def askopenfilename():
    return tkFileDialog.askopenfile()
Example #46
0
def myFileOpen():
    storeFile = tkFileDialog.askopenfile()
    myLabel = Label(text=storeFile).pack()
Example #47
0
def BrowesFiles(file_name):
    file_name = tkFileDialog.askopenfile(parent=root,
                                         mode='rb',
                                         title='Choose a file')
Example #48
0
def getFile():
    global f
    a = tkFileDialog.askopenfile(parent=root, mode='r', title='Select a PCAP')
    f = a.name
    b = "File: " + f
    fl_lbl = tk.Label(root, text=b).pack()
Example #49
0
	def open_command(self):
		self.open_file = askopenfile(filetypes=[("Text files", "*.pleasegivemealltens")])
		self.regions = pickle.load(self.open_file)
Example #50
0
def fopen():
    global seq
    f = dialog.askopenfile(parent=top, mode='rb', title='Choose a file')
    seq = f.read()
    text.insert(END, seq)
Example #51
0
 def openDoc(self):
     openFile = tk.askopenfile(mode='r')
     text = openFile.read()
     self.text1.insert(END, text)
     openFile.close()
Example #52
0
                                  password=password,
                                  caching=caching,
                                  check_extractable=False):
        interpreter.process_page(page)
    fp.close()
    device.close()
    str = retstr.getvalue()
    retstr.close()
    return str


root = Tkinter.Tk()
# getting term list
terms_file = tkFileDialog.askopenfile(parent=root,
                                      initialdir=myinitialdir,
                                      title='Choisir la liste des termes',
                                      filetypes=(('TXT file', '*.txt'),
                                                 ('all files', '*.*')))
# if file1 != None:
# 	terms = file1.read().splitlines()
# terms_file = open('terms.txt', 'r')
terms = terms_file.read().splitlines()

if donicer == 1:
    # getting nicer file
    mynicerfile = tkFileDialog.askopenfilename(
        parent=root,
        initialdir=myinitialdir,
        title=mydialoglabfile,
        filetypes=(('CSV or XML files', '*.csv;*.xml'), ('all files', '*.*')))
    mydir = os.path.split(mynicerfile)[0]
def ouvrir_fichier():
    global filename, liste_data
    filename = tkFileDialog.askopenfile(parent=root)
    liste_data = lire_colonne_csv(rs.lire_csv(filename))
Example #54
0
 def openNeutralFile(self):
     selectedNeutralFileName = tkFileDialog.askopenfile(
         parent=self.frame_right,
         initialdir='/home/',
         title='Select your neutral file')
     self.neutralFilePathVariable.set(selectedNeutralFileName.name)
Example #55
0

def save_image(fluor_name, image):
    output_file = os.path.join(output_dir, "%s.tiff" % fluor_name)
    if len(base_img.shape) == 2:
        slide = image
        for nr_row, row in enumerate(slide):
            for nr_pix, pix in enumerate(row):
                base_img[nr_row][nr_pix] = np.uint16(image[nr_row][nr_pix])
    else:
        for nr_slide, slide in enumerate(image):
            for nr_row, row in enumerate(slide):
                for nr_pix, pix in enumerate(row):
                    base_img[nr_slide][nr_row][nr_pix] = np.uint16(
                        image[nr_slide][nr_row][nr_pix])
    io.imsave(fname=output_file, arr=base_img)
    return


output_image = {}
matrix = read_unmix_matrix()
for work_channel in channels:
    output_image = read_image(work_channel, matrix, output_image)
output_dir = tkFileDialog.askdirectory(
    title="Where do you want the unmixed images saved?")
base_img = io.imread(
    tkFileDialog.askopenfile(
        title="Select tiff file for format information").name)
for fluor in fluors:
    save_image(fluor, output_image[fluor])
Example #56
0
def loadImage():
    file = tkFileDialog.askopenfile(title='Choose a file')
    if file != None:
        print(file.name)
        detect_number(file.name)
Example #57
0
#======== Select a directory:
#
# import Tkinter, tkFileDialog
#
# root = Tkinter.Tk()
# dirname = tkFileDialog.askdirectory(parent=root,initialdir="/",title='Please select a directory')
# if len(dirname ) > 0:
#     print "You chose %s" % dirname


# ======== Select a file for opening:
import Tkinter,tkFileDialog

root = Tkinter.Tk()
file = tkFileDialog.askopenfile(parent=root,mode='rb',title='Choose a file')
if file != None:
    data = file.read()
    file.close()
    print "I got %d bytes from this file." % len(data)


# ======== "Save as" dialog:
# import Tkinter,tkFileDialog
#
# myFormats = [
#     ('Windows Bitmap','*.bmp'),
#     ('Portable Network Graphics','*.png'),
#     ('JPEG / JFIF','*.jpg'),
#     ('CompuServer GIF','*.gif'),
#     ]
Example #58
0
# and convert to ascii for easy visualization

import re  # import regular expression module

# regular expression shall contain at least 2 groups CAN id and data (8 bytes)
re_searchpattern = "(?:Rx\s*)(.{8})(?:.{5})(.+)"

from Tkinter import *
import Tkinter, Tkconstants, tkFileDialog, tkMessageBox
from logging import exception

# Open a dialog to select the source trace file
tkMessageBox.showinfo("Select File", "Select Trace file to process")
root = Tk()
root.filename = tkFileDialog.askopenfile("r",
                                         filetypes=(("trace files", "*.trc"),
                                                    ("all files", "*.*")))
trace_file = root.filename.readlines()
root.filename.close()


# definition of a TP Package object, start: position on list where TP CM was fond
# end: last package
# data: ascii data of the TP package
class TP_Package:
    def __init__(self, start, end, data):
        self.start = start
        self.end = end
        self.data = data

    def init_packet(self):
Example #59
0
             objective_tolerance=float(arg)
         elif opt in ("--absolute","-a"):
             relative_tolerance=False
         elif opt in ("--reaction_list_file","-r"):
             reaction_list_file=arg
         elif opt in ("max_cycles_without_improvement","-m"):
             max_cycles_without_improvement=int(arg)



print file_name

if file_name==None:
    tk=Tkinter.Tk()
    tk.withdraw()
    loaded_file = tkFileDialog.askopenfile(title='Select iso2flux file',filetypes=[("iso2flux",".iso2flux")]) 
    file_name=loaded_file.name
    tk.destroy()

print "file_name",file_name


if ".iso2flux" not in file_name:
    file_name+=".iso2flux"


if output_prefix==None:
   output_prefix=file_name.split("/")[-1].replace(".iso2flux","") 
     

Example #60
0
 def opensurf(self):
     """Opens the file selecting window and sends the file selected to the server"""
     global fil
     fil = tkFileDialog.askopenfile(
         parent=self, mode='r+b',
         title='Choose a file')  # opens file surfing