Пример #1
0
def friends_req_got(userData, friendshipData):
    people = friendshipData.get_friendship_incoming_reqests(userData.Username)
    msg ="Hello " + userData.Name +" \n" + "Please select users for accepting Freind Request"
    title = "Friend req got"
    choices = choice_maker(people)
    user_resp = easygui.multchoicebox(msg, title, choices)
    return user_resp
Пример #2
0
def other_users(userData, friendshipData):
    people = friendshipData.get_other_users(userData.Username)
    remove_current_user(people, userData.Username)
    msg ="Hello " + userData.Name +" \n\n" + "Please select users for sending Freind Request"  
    title = "Other Users"
    choices = choice_maker(people)
    user_resp = easygui.multchoicebox(msg, title, choices)
    return user_resp
Пример #3
0
def generate_easygui_deal(cardsinround):
    areYouSure = False
    while not areYouSure:
        translated_choices = [translate_card_name(i) for i in all_cards_in_deck]
        hand = easygui.multchoicebox(msg='Select ' + str(cardsinround) + ' cards', title='Dealing',
                                     choices=translated_choices)
        translated_hand = [translate_inv_card_name(i) for i in hand]
        if len(translated_hand) == cardsinround:
            areYouSure = True
    return translated_hand
def join_on(headers, sql_msg):
    """ Get 1 or more columns that contains the key to join on """
    cols = eg.multchoicebox(msg='From the 1st file, which columns contain the common data fields between the two files?{0}'.format(sql_msg), choices=headers)
    
    col_nums = []
    for col in cols:
        col_num = headers.index(col)
        col_nums.append(col_num)
    
    return col_nums
Пример #5
0
def getAndPrintFollowers(twitterHandle):
    eg.msgbox("Please wait while all of your followers are loaded")
    users = tweepy.Cursor(api.followers, screen_name=twitterHandle).items()
    userList =[];
    for user in users:
        userList.append(user.screen_name)
    question = "Who do you not want following you anymore? We will block and unblock them to remove the connection"
    title = "Potential Unfollower"
    choice = eg.multchoicebox(question, title, userList)
    return choice
Пример #6
0
 def processMiddleClick(self):
     activeList = list()
     nameList = list()
     for drawable in self.drawList:
         drawable.active = False
         nameList.append(drawable.name)
     import easygui
     makeActiveList = easygui.multchoicebox(msg="Select which world objects you'd like to be visible",
             title='View options:',
             choices=(nameList))
     for target in makeActiveList:
         for drawable in self.drawList:
             if target == drawable.name:
                 drawable.active = True 
    def gui_select_artifacts(self, task_name="", task_id=""):
        """
        GUI: select the artifacts. (multiple)
        @param task_name: the task name.
        @param task_id: the task id.
        @return: list of selections.
        """
        try:
            choices = self._get_latest_artifacts(task_id)
            title = "Select Artifacts"
            if task_name:
                logger.info("Task Namespace: {}".format(task_name))
                logger.info("Task ID: {}".format(task_id))
                msg = textwrap.dedent(
                    """\
                Please select the artifacts you want to download.

                - Task Name: [{}]
                - Task ID: [{}]

                * Tips: [↑][↓] Move, [Space] Select, [Enter] OK
                """
                ).format(task_name, task_id)
            else:
                logger.debug("Task ID: {}".format(task_id))
                msg = textwrap.dedent(
                    """\
                Please select the artifacts you want to download.

                - Task ID: [{}]

                * Tips: [↑][↓] Move, [Space] Select, [Enter] OK, [Esc] Cancel
                """
                ).format(task_id)
            return easygui.multchoicebox(msg, title, choices)
        except Exception as e:
            title = "Exception"
            msg = textwrap.dedent(
                """\
            Error: [{}] [{}]

            Exception: {}

            * Tips: [Enter] OK
            """
            ).format(task_name, task_id, e)
            easygui.msgbox(msg, title)
            return []
Пример #8
0
def app_gui():
    main_button_choices = ("日常任务", "自动寻墨", "自动爬塔", "配置页面", "终止程序")
    richang_button_choices = ("自动副本", "自动阵图", "自动璇玑", "自动分解")
    #主界面
    button_return = g.buttonbox('仅供学习使用,如造成损失,使用者责任自负!',
                                '蜀山传奇辅助脚本',
                                choices=("日常任务", "自动寻墨", "自动爬塔", "配置页面",
                                         "终止程序"))
    if button_return == main_button_choices[0]:
        choice_return = g.multchoicebox('请选择自动打怪的类型,可多选',
                                        '',
                                        choices=("自动副本", "自动阵图", "自动璇玑",
                                                 "自动分解"))
    elif button_return == main_button_choices[1]:
        xunmo_run()
    elif button_return == main_button_choices[3]:
        config_gui()
Пример #9
0
def EngineDistrict():
    value = g.enterbox(msg="爬虫引擎:", title='搜索')
    text = value
    #文本纠错
    arg1 = "correct_query"  #纠正后的text
    arg2 = "correct_frag"  #错误单词纠正
    arg3 = "ori_frag"  #原来错误片段
    out = {}
    try:
        out = client.ecnet(text)
        #print(client.ecnet(text))
        if out["item"]["vec_fragment"]:
            print(out["item"]["vec_fragment"][0][arg3])
            print(out["item"]["vec_fragment"][0][arg2])
            print(out["item"][arg1])
        else:
            print(out["item"][arg1])
        request1 = out["item"][arg1]
        #词法分析关键名词
        out2 = client.lexerCustom(request1)  #搜索关键词分词
        fenci = ""
        for i in out2["items"]:
            fenci += i["item"] + "/"
            print(i["item"])
        start = time.time()
        sousuo = getSearchByDesc(request1, content2http)
        end = time.time()

        index = g.indexbox(msg=fenci,
                           title="这是你的分词结果,共计用时" + str(end - start),
                           choices=["点击查看搜索结果", "不看了"])
        if index == 0:
            mult = g.multchoicebox(msg="以下为地址列表,共有" + str(len(sousuo)) + "条结果",
                                   title="搜索结果",
                                   choices=sousuo)
            if mult != None:
                for i in mult:
                    i_list = i.split(",")
                    #print(i_list[1][2:-1])
                    webbrowser.open(i_list[1][2:-1], new=0, autoraise=True)
            SystemDistrict()
        else:
            SystemDistrict()

    except BaseException:
        sys.exit(0)
Пример #10
0
def main():
    name = "LOLBind"

    if sys.platform == "darwin":
        Tk().destroy()
        # Next we activate it
        Popen(['osascript', '-e', 'tell application "Python" to activate'])

        key_settings_path = "/Applications/League of Legends.app/Contents/LoL/Config/PersistedSettings.json"
    elif sys.platform == "win32" or sys.platform == "win64":
        key_settings_path = "C:\Riot Games\League of Legends\Config\PersistedSettings.json"
    else:
        easygui.msgbox("Unsupported operating system. LOLBind will now quit.", name)
        sys.exit(0)

    with open(key_settings_path, "r") as f:
        jo = json.load(f)
        ks = jo["files"][1]["sections"][0]["settings"]
        i = 0
        for k in ks:
            if k["name"] == "evtChampMasteryDisplay":
                cont = easygui.msgbox("Mastery Emote currently bound to %s.\nPress okay to continue." %
                               jo["files"][1]["sections"][0]["settings"][i]["value"], name)
                if cont == "OK":
                    keys_to_bind = easygui.multchoicebox("Select keys you want to bind to Mastery Emote",
                                                         title=name, choices=["q", "w", "e", "r", "d", "f"])
                    mastery_key = "[Ctrl][6]"
                    if keys_to_bind is not None:
                        for key in keys_to_bind:
                            mastery_key = ("[%s]," % key) + mastery_key
                    jo["files"][1]["sections"][0]["settings"][i]["value"] = mastery_key
                break
            i += 1

    if cont == "OK":
        with open(key_settings_path, "w") as f:
            json.dump(jo, f)
            if easygui.msgbox("Sucessfully changed mastery keys to %s.\nTo change bound keys click okay." % mastery_key,
                              name) == "OK":
                f.close()
                main()
            else:
                sys.exit(0)
    else:
        sys.exit(0)
def choose_columns(headers1, headers2, sql_msg):
    all_headers = map(lambda x: 'a.'+x, headers1) + map(lambda x: 'b.'+x, headers2)
    
    columns_chosen = eg.multchoicebox(msg='Choose the columns you want to export{0}'.format(sql_msg), choices=all_headers)
    sql_msg += ' '
    sql_msg += ', '.join(columns_chosen)
    
    indexes1 = []
    indexes2 = []
    for column in columns_chosen:
        if column[0:1] == 'a':
            indexes1.append(headers1.index(column[2:]))
        elif column[0:1] == 'b':
            indexes2.append(headers2.index(column[2:]))
        else:
            continue
    
    return indexes1, indexes2, sql_msg
Пример #12
0
def createCfg(pathdir_mod, file_exts):
    files = listFiles(pathdir_mod, file_exts)
    cfg_files = eg.multchoicebox(msg='Pick as many items as you like.', title='Choose files', choices=files)
    if cfg_files:
        cfg_filename = input("Type a name for the CFG: ") + fileext_cfg
        pathfile_cfg = os.path.join(pathdir_mod, 'MiniModManager', cfg_filename)
        f = open(pathfile_cfg, 'w')
        for line in cfg_files:
            f.write(line + '\n')
        f.close()
        print("CFG created/edited.")

        key = input('Do you want to use the just-created config? y/<n>: ').lower()
        if key == 'y':
            files_filter = readCfg(pathfile_cfg)  # open cfg
            renFiles(pathdir_mod, files, files_filter, 'X')  # rename files with 'X' in the end
    else:
        print("No CFG was created/edited.")
Пример #13
0
def enter_borders(db, qry):
    title = "Map Color"
    state_set = set()
    state_dict = dict()
    for state in db:
        # make a set of the state names
        state_set.add(state.doc_id)
        state_dict[state.doc_id] = state['name']

    for state in db:
        # make a set of the borders
        border_set = set(state['borders'])
        border_states_available = state_set.difference(border_set)
        #print('borders available: ',border_states_available)
        s_id = state.doc_id
        s_name = state['name']
        tlist = [
        ]  # make a copy of the borders list, not an alias to the borders list
        for b_id in border_states_available:
            s_n = state_dict[b_id]
            tlist.append(s_n)

        tlist.remove(s_name)  # don't enter a border with itself
        msg = "Enter Borders for " + s_name
        nlist = eg.multchoicebox(msg, title, tlist)
        #print(nlist, 'nlist')
        if nlist is not None:
            dlist = []
            for n in nlist:
                s = db.get(qry.name == n)
                dlist.append(s.doc_id)
            # update the borders for this state
            db.update({'borders': dlist}, doc_ids=[s_id])
            # update the borders for this state
            # update the states that this state borders
            for d in dlist:
                s = db.get(doc_id=d)
                if s is not None:
                    border_set = set(s['borders'])
                    border_set.add(state.doc_id)
                    blist = list(border_set)
                    db.update({'borders': blist}, doc_ids=[d])
                else:
                    print('state not found')
Пример #14
0
def chooseItems(foodOptionsList, newItem, carbsList, proteinsList, vegeList,
                foodList):
    if len(newItem) > 1:
        newItem = newItem[0:1]
    foodOptionsList = sorted(foodOptionsList)
    if foodOptionsList[0] == "":
        foodOptionsList = foodOptionsList[1:]
    choices = eg.multchoicebox(msg="What do you want to eat?",
                               title="Choose Food",
                               choices=foodOptionsList)
    newItem += choices
    msg = "Are you sure you want:" + "\n"
    for i in range(1, len(newItem)):
        msg += "".join(newItem[i]) + ", "
    msg = msg[:-2]
    if eg.ccbox(msg):
        score = calculate_grade(choices, carbsList, proteinsList, vegeList)
        newItem.append(str(score))
        # print newItem
        if score == 1:
            image = "resources/1fullapple.gif"
        elif score == 2:
            image = "resources/2fullapples.gif"
        elif score == 3:
            image = "resources/3fullapples.gif"
        elif score == 4:
            image = "resources/4fullapples.gif"
        else:
            image = "resources/5fullapples.gif"
        reply = eg.buttonbox(image=image,
                             choices=[
                                 "Oy Vey! I want to change that!",
                                 "Great! I'll stick with that!"
                             ])
        if reply == "Oy Vey! I want to change that!":
            chooseItems(foodOptionsList, newItem, carbsList, proteinsList,
                        vegeList, foodList)
        else:
            foodList.append(newItem)
            welcomeWindow(proteinsList, vegeList, carbsList, foodOptionsList,
                          foodList)
    else:
        chooseItems(foodOptionsList, newItem, carbsList, proteinsList,
                    vegeList, foodList)
Пример #15
0
def get_data_choices():
    options = ["Acceleration", "Gyro", "Temp"]
    choices = gui.multchoicebox("Choose the data to be plotted.", "Sensors",
                                options)
    if choices is None:  #if there is no choice selected, stop running the program
        return -1

    if choices.count(
            "Acceleration"
    ) == 1:  #if Acceleration is checked parse the acceleration data
        selections = get_axis_choices()
        parse.plot_accel(selections)

    if choices.count("Gyro") == 1:  #if gyro is checked parse the gyro data
        selections = get_axis_choices()
        parse.plot_gyro(selections)

    if choices.count("Temp") == 1:  #if temp is checked parse the temp data
        parse.plot_temp()
Пример #16
0
def exclude_players(df):
	import pandas as pd
	import numpy as np
	import FF_scoring 
	import easygui as eg

	players = pd.unique(df.Name.ravel()) #getting a list of teams for the week 
	question = "Select players to exclude"
	title = "Select players"
	listOfOptions = players
	choice = eg.multchoicebox(question , title, listOfOptions)
	print choice
	cont = raw_input("Exclude these players (if none are showing, there are none selected)? (y/n)")
	cont = str(cont)
	if cont == 'y':
		df = df[~df.Name.isin(choice)] #removing the teams
	else:
		df = FF_scoring.exclude_players(df)
	return df
Пример #17
0
    def spatially_combine_data(self, new_name, 
                               lambdas, 
                               column = None, 
                               name_list=None):
        """ Combine multiple spatial data sources with factors
        
        Alphabetically order the weights!
        
        Parameters
        ----------
        new_name : str
            Name for the new dataframe
        
        lambdas : List or numpy.Array of floats
            The weights
        
        column : str (optional)
            Which column to combine.
            !! When None, it can cause errors when certain columns are
            not float.
            
        name_list : List
            Which dataframes to combine. If None, use gui to select.
        
        Returns
        -------
        new_df : pandas.DataFrame
            The combined dataframe
        """
        if name_list is None:
            name_list = easygui.multchoicebox(msg="Pick the to combine dataframes",
                                              choices=[item for item in self.data_dict])
            

        name_list.sort()
        if column is not None:
            df_list = [self.data_dict[name_list[i]][column]*lambdas[i] for i in range(len(name_list))]
        else:
            df_list = [self.data_dict[name_list[i]]*lambdas[i] for i in range(len(name_list))]
        new_df = sum(df_list)
        
        self.data_dict[new_name] = new_df
        return new_df        
Пример #18
0
 def remove_friends(self):
     """ Removing Friends from Friends List """
     img = "chat.gif"
     msg = "Select Friends to Remove!"
     un = self.username
     val = json.loads(self.re.get(un))
     # Users registered in DB
     friends = eg.multchoicebox(msg, self.title, val[4], image=img)
     if friends is not None:
         fr = set(friends)
         temp = set(val[4])
         temp.difference_update(fr)
         val[4] = list(temp)
         val = json.dumps(val)
         self.re.set(un, val)
         self.re.bgsave()
         return 1
     else:
         return 0
Пример #19
0
def spl_fit(band):
	lc=np.loadtxt('lc2fit_'+band+'.dat', skiprows=8)
	ph=lc[:,0]-tmax
	plt.plot(ph, lc[:,1])
	nsamp=100
	a=eg.multchoicebox("choose from range:", "choices", ph)
	t_arr=[]
	
	cond=(ph>float(a[0])) & (ph<float(a[1]))
	ph1=ph[cond]
	print a
	for k in range(nsamp):
		real=np.random.normal(lc[:,1][cond], lc[:,2][cond])
		ter=interp1d(ph[cond], real, kind='cubic')
		l=np.linspace(ph1.min(), ph1.max())
		kk=ter(l)
		t=l[kk==min(kk)]
		t_arr.append(t[0])
	return np.array(t_arr)	
Пример #20
0
def spl_fit(band):
    lc = np.loadtxt('lc2fit_' + band + '.dat', skiprows=8)
    ph = lc[:, 0] - tmax
    plt.plot(ph, lc[:, 1])
    nsamp = 100
    a = eg.multchoicebox("choose from range:", "choices", ph)
    t_arr = []

    cond = (ph > float(a[0])) & (ph < float(a[1]))
    ph1 = ph[cond]
    print a
    for k in range(nsamp):
        real = np.random.normal(lc[:, 1][cond], lc[:, 2][cond])
        ter = interp1d(ph[cond], real, kind='cubic')
        l = np.linspace(ph1.min(), ph1.max())
        kk = ter(l)
        t = l[kk == min(kk)]
        t_arr.append(t[0])
    return np.array(t_arr)
Пример #21
0
def oldenter_borders(db, qry):
    map = read_states_for_borders(db, qry)
    title = "Map Color"
    state_set = set()
    state_dict = dict()
    state_dict_name_id = dict()
    state_dict_borders = dict()
    for state in map:
        # make a set of the state names to be used to build the
        # borders to be checked against
        state_set.add(state.id)
        state_dict[state.id] = state.name
        state_dict_name_id[state.name] = state.id

        ########       #this is to be used to update the borders list for selected states
        #it puts co into nm when nm is selected as a border for co
        #this does not work yet. The dictionary is not used yet.
        state_dict_borders[state.name] = state.borders

    for state in map:
        # get available states to check for borders
        border_states_available = state_set.difference(state.borders)
        s_id = state.id
        s_name = state.name
        tlist = []  # make a list of border states available
        for b_id in border_states_available:
            s_n = state_dict[b_id]
            tlist.append(s_n)

        tlist.remove(s_name)  # don't enter a border with itself
        msg = "Enter Borders for " + s_name
        nlist = eg.multchoicebox(msg, title, tlist)
        if nlist is not None:
            dlist = set()
            for n in nlist:
                """create a set of borders for this state"""
                s = state_dict_name_id[n]
                dlist.add(s)

            # update this states borders
            state.borders = state.borders | dlist
            # update the borders for this state
            db.update({'borders': list(dlist)}, doc_ids=[s_id])
Пример #22
0
    def RH_filter(self, name_list=None, inplace=True):
        """
        """

        data_dict = self.data_dict

        if name_list is None:
            name_list = easygui.multchoicebox(
                msg="Pick to filter dataframes",
                choices=[item for item in self.data_dict])

        for name in name_list:
            data_dict[name].loc[data_dict[name]['RH'] < 1., 'RH'] = 0
            new_df = data_dict[name] / 10.

            if inplace:
                self.data_dict[name] = new_df

            else:
                self.data_dict[name + 'F'] = new_df
Пример #23
0
def which_scores(df):
	import pandas as pd
	import numpy as np
	import FF_scoring 
	import easygui as eg

	scores = df.columns.values
	players = pd.unique(df.Name.ravel()) #getting a list of teams for the week 
	question = "Select scores to include"
	title = "Select scores"
	listOfOptions = scores
	choice = eg.multchoicebox(question , title, listOfOptions)
	print choice
	cont = raw_input("Include these scores (if none are showing, there are none selected)? (y/n)")
	cont = str(cont)
	if cont == 'y':
		score_list = list(choice) #removing the teams
	else:
		df = FF_scoring.which_scores(df)
	return score_list
Пример #24
0
    def chat_window_gui(self):
        """ Chat Window GUI """
        img = "chat.gif"
        msg = "Choose the Friends to talk!"
        # No. of users registered in DB
        # nou = self.re.dbsize()
        # Friends added to profile
        fr = json.loads(self.re.get(self.username))
        if fr[4] == []:
            friends = ['']
        else:
            friends = fr[4]

        fr = eg.multchoicebox(msg, self.title, friends, image=img)
        if fr == ['']:
            eg.msgbox("Add Friends to Start Chatting!", title=self.title)
            return 0
        else:
            self.friends = fr
            return self.gui()
def search_url():
    f = open('list.txt', 'r', encoding='utf-8')
    txt = []
    line = f.readline()
    while line:
        string = re.search('(.*?)https', line)
        txt.insert(0, string.group(1) + '\n')
        line = f.readline()
    f.close()
    choices = t.multchoicebox(msg='选择需要下载的话', title='', choices=txt)
    if choices is None:
        return
    f = open('list.txt', 'r', encoding='utf-8')
    lst = f.read()
    names_urls = {}
    for choice in choices:
        string = re.search(choice.replace("\n", "") + '.*?(ht.*?html)', lst)
        names_urls.update({choice: string.group(1)})
    f.close()
    return names_urls
Пример #26
0
 def add_friends(self):
     """ Adding Friends to Personal List """
     img = "chat.gif"
     msg = "Select People to add as your Friends!"
     un = self.username
     val = json.loads(self.re.get(un))
     # Users registered in DB
     self.users = self.re.keys('*')
     self.users.remove(self.username)
     friends = eg.multchoicebox(msg, self.title, self.users, image=img)
     if friends is not None:
         fr = list(set(friends))
         val[4].extend(fr)
         #print val[4]
         val[4] = list(set(val[4]))
         val = json.dumps(val)
         self.re.set(un, val)
         self.re.bgsave()
         return 1
     else:
         return 0
    def gui_select_artifacts(self, task_name='', task_id=''):
        """
        GUI: select the artifacts. (multiple)
        @param task_name: the task name.
        @param task_id: the task id.
        @return: list of selections.
        """
        try:
            choices = self._get_latest_artifacts(task_id)
            title = 'Select Artifacts'
            if task_name:
                msg = textwrap.dedent('''\
                Please select the artifacts you want to download.

                - Task Name: [{}]
                - Task ID: [{}]

                * Tips: [↑][↓] Move, [Space] Select, [Enter] OK
                ''').format(task_name, task_id)
            else:
                msg = textwrap.dedent('''\
                Please select the artifacts you want to download.

                - Task ID: [{}]

                * Tips: [↑][↓] Move, [Space] Select, [Enter] OK, [Esc] Cancel
                ''').format(task_id)
            return easygui.multchoicebox(msg, title, choices)
        except Exception as e:
            title = 'Exception'
            msg = textwrap.dedent('''\
            Error: [{}] [{}]

            Exception: {}

            * Tips: [Enter] OK
            ''').format(task_name, task_id, e)
            easygui.msgbox(msg, title)
            return []
Пример #28
0
 def change_values(self, data, og_data, subjects):
     IDs_for_change = eg.multchoicebox(
         msg='Select the subject(s) for a change: ',
         title='Select...',
         choices=subjects)
     columns = data.columns.tolist()
     new_value_change = True
     while new_value_change == True:
         values_to_change = eg.choicebox(
             msg='The following values are available for change: ',
             title='Select...',
             choices=columns)
         set_value = eg.enterbox(
             msg=f'Enter a new value for {values_to_change}: ',
             title='New value...')
         for values in IDs_for_change:
             try:
                 data.at[values, values_to_change] = set_value
                 data.at[values,
                         'acceptedNameUsage'] = '{0} {1} {2}'.format(
                             data.at[values, 'genus'],
                             data.at[values, 'specificEpithet'],
                             data.at[values, 'nameAcordingTo'])
                 og_data.at[values, values_to_change] = set_value
                 og_data.at[values,
                            'acceptedNameUsage'] = '{0} {1} {2}'.format(
                                data.at[values, 'genus'],
                                data.at[values, 'specificEpithet'],
                                data.at[values, 'nameAcordingTo'])
             except:
                 print('The changes can not be made')
                 pass
         new_value_change = eg.ynbox(
             msg='Do you want to change another values in this subjects?',
             title='Value change')
     return data
Пример #29
0
def main():

    #will check for all files from script directory onwards
    print(os.getcwd(), ":")  #get dir address for current file
    files_dir = list()
    for root, dirs, files in os.walk('.'):
        for file in files:
            if '.xlsx' in file:
                files_dir.append(file)
                print("\t", file)

    print("")
    #dialog box to choose file
    msg = "Please choose file to consolidate or Press <Cancel> to exit."
    title = "Directory List of .xlsx Files"
    choice_list = {}
    choice_list = multchoicebox(msg, title, files_dir)

    if choice_list is None:
        sys.exit("No file was selected..")

    sheetname = 'Part 6 Price Schedule'
    data_file = 'output.xlsx'
    writer = pd.ExcelWriter(data_file)

    for filename in choice_list:
        unmerged_filename = unmerge_file(filename, sheetname)
        df = clean_compile(unmerged_filename, sheetname)
        os.remove(unmerged_filename)
        df.to_excel(writer, sheet_name=filename.split('.')[0])
    writer.save()
    writer.close()

    combine_lists(data_file)

    print("Compilation complete!")
Пример #30
0
    def basic_filter(self, zval=1.5, name_list=None, inplace=True):
        """Do a basic, general filter over the given data. 
        Method is the Standard score: 
                https://en.wikipedia.org/wiki/Standard_score 
                (also called z-score)
        
        When single column, removes rows.
        When multiple columns, turns into NaN. 
        
        Does not return anything, but saves it to object.
        
        Parameters
        ----------
        zval : float (optional)
            Default The maximum z-score of items. Higher than this value will
            be removed
            
        names : list of str (optional)
            The items you want to filter 
        
        inplace : bool (optional)
            Default value: True. When True, replaces old data.
            Else, saves with new name; with 'F' appended to old name.
        
        
        """
        data_dict = self.data_dict

        if name_list is None:
            name_list = easygui.multchoicebox(
                msg="Pick to filter dataframes",
                choices=[item for item in self.data_dict])

        for name in name_list:
            if len(data_dict[name].columns) == 1:
                #print("test")
                column = 'Value'
                #print(data_dict[name][column])
                #zscore = data_dict[name][column]
                #print(~np.isnan(data_dict[name][column]))
                #z_score[~np.isnan(data_dict[name][column])] = zscore(
                #    data_dict[name][column][~np.isnan(data_dict[name][column])])
                z_score = zscore(data_dict[name][column], nan_policy='omit')
                #print(z_score)
                z_filter = np.where(
                    np.abs(z_score) < zval)  # or z_filter, _ = ???
                z_remove = np.where(
                    np.abs(z_score) > zval)  # or z_filter, _ = ???
                df_remove = data_dict[name][column].iloc[z_remove]
                new_df = data_dict[name].iloc[z_filter]

            else:
                columns = data_dict[name].columns.values
                for column in columns:
                    z_score = zscore(data_dict[name][column])
                    z_remove = np.where(
                        np.abs(z_score) > zval)  # or z_filter, _ = ???
                    data_dict[name][column].iloc[z_remove] = np.NaN
                    new_df = data_dict[name]

            if inplace:
                self.data_dict[name] = new_df

            else:
                self.data_dict[name + 'F'] = new_df
        return df_remove
Пример #31
0
        	os.rmdir(pth)
        	print pth
        except OSError:
    		pass

# Open a window to choose the location copying from
source_dir = eg.diropenbox(title='Choose Source Directory')

# allFileTypes is the list of all extensions in source_dir
# grabbed with function getFileExtList
allFileTypes = getFileExtList(source_dir)
# delete the blank file type
del allFileTypes[0]

# Open a window to choose the files to copy
copyList = eg.multchoicebox(msg='Select the file types to copy',
				choices=(allFileTypes))
print "Extensions to copy: " + str(copyList)

# List comprehension adds the asterisk for glob
# while making an ignore list for copytree
ignoreList = ['*' + x for x in allFileTypes if x not in copyList]

	

# Open a window to choose the destination directory
root_dir = eg.diropenbox(title='Choose Destination Directory')

dest_dir = os.path.join(root_dir, os.path.basename(source_dir))

# copytree everything from the source_dir to the dest_dir ignoring
# all files types not chosen from the list
		break
	
	# Get the number of clusters in the chosen solution
	num_clusters = easygui.multenterbox(msg = 'Which solution do you want to choose for electrode %i?' % electrode_num, fields = ['Number of clusters in the solution'])
	num_clusters = int(num_clusters[0])

	# Load data from the chosen electrode and solution
	spike_waveforms = np.load('./spike_waveforms/electrode%i/spike_waveforms.npy' % electrode_num)
	spike_times = np.load('./spike_times/electrode%i/spike_times.npy' % electrode_num)
	pca_slices = np.load('./spike_waveforms/electrode%i/pca_waveforms.npy' % electrode_num)
	energy = np.load('./spike_waveforms/electrode%i/energy.npy' % electrode_num)
	amplitudes = np.load('./spike_waveforms/electrode%i/spike_amplitudes.npy' % electrode_num)
	predictions = np.load('./clustering_results/electrode%i/clusters%i/predictions.npy' % (electrode_num, num_clusters))

	# Get cluster choices from the chosen solution
	clusters = easygui.multchoicebox(msg = 'Which clusters do you want to choose?', choices = tuple([str(i) for i in range(int(np.max(predictions) + 1))]))
	
	# Check if the user wants to merge clusters if more than 1 cluster was chosen. Else ask if the user wants to split/re-cluster the chosen cluster
	merge = False
	re_cluster = False
	if len(clusters) > 1:
		merge = easygui.multchoicebox(msg = 'I want to merge these clusters into one unit (True = Yes, False = No)', choices = ('True', 'False'))
		merge = ast.literal_eval(merge[0])
	else:
		re_cluster = easygui.multchoicebox(msg = 'I want to split this cluster (True = Yes, False = No)', choices = ('True', 'False'))
		re_cluster = ast.literal_eval(re_cluster[0])

	# If the user asked to split/re-cluster, ask them for the clustering parameters and perform clustering
	split_predictions = []
	chosen_split = 0
	if re_cluster: 
Пример #33
0
 def _multchoicebox(msg='', choices=[], title=''):
     return eg.multchoicebox(msg, title, choices)
Пример #34
0
num_clusters = easygui.multenterbox(
    msg='Which solution do you want to choose for electrode %i?' %
    electrode_num,
    fields=['Number of clusters in the solution'])
num_clusters = int(num_clusters[0])

# Load data from the chosen electrode and solution
spike_waveforms = np.load('./spike_waveforms/electrode%i/spike_waveforms.npy' %
                          electrode_num)
predictions = np.load(
    './clustering_results/electrode%i/clusters%i/predictions.npy' %
    (electrode_num, num_clusters))

# Get cluster choices from the chosen solution
clusters = easygui.multchoicebox(
    msg='Which clusters do you want to choose?',
    choices=tuple([str(i) for i in range(int(np.max(predictions) + 1))]))
for i in range(len(clusters)):
    clusters[i] = int(clusters[i])

# Get the current plot data
plot_data = []
for cluster in clusters:
    plot_data.append(np.where(predictions == cluster)[0])
plot_data = spike_waveforms[plot_data]

# Set up data
N = 0
x = np.arange(len(plot_data[N]) / 10)
y = spike_waveforms[0, ::10]
source = ColumnDataSource(data=dict(
Пример #35
0
hdf5_name = ''
for files in file_list:
    if files[-2:] == 'h5':
        hdf5_name = files

# Open the hdf5 file
hf5 = tables.open_file(hdf5_name, 'r+')

# Now ask the user to put in the identities of the digital inputs
trains_dig_in = hf5.list_nodes('/spike_trains')
identities = easygui.multenterbox(
    msg='Put in the taste identities of the digital inputs',
    fields=[train._v_name for train in trains_dig_in])

# Ask what taste to plot
plot_tastes = easygui.multchoicebox(msg='Which tastes do you want to plot? ',
                                    choices=([taste for taste in identities]))
plot_tastes_dig_in = []
for taste in plot_tastes:
    plot_tastes_dig_in.append(identities.index(taste))

# Ask the user for the pre stimulus duration used while making the spike arrays
pre_stim = easygui.multenterbox(
    msg='What was the pre-stimulus duration pulled into the spike arrays?',
    fields=['Pre stimulus (ms)'])
pre_stim = int(pre_stim[0])

# Get the psth paramaters from the user
params = easygui.multenterbox(msg='Enter the parameters for making the PSTHs',
                              fields=['Window size (ms)', 'Step size (ms)'])
for i in range(len(params)):
    params[i] = int(params[i])
Пример #36
0
# coding:utf-8

#    __author__ = 'Mark sinoberg'
#    __date__ = '2016/5/25'
#    __Desc__ = 一个多选的列表项.呵呵了,这个版本貌似有问题。我的多选并没有真正的实现

import easygui

msg = '选择此列表项中你喜欢的一个吧'
title = '必须选择一个哦'
choices = (1,2,3,4,5,6,7,8,9)
answer1 = easygui.multchoicebox(msg,title,choices)
for item in answer1:
    print item
Пример #37
0
        title="\t\tEscoger directorio", msg="\n" + "\tSeleccione el directorio con los archivos csv"
    )
    salida(directorio)

    opciones = next(os.walk(directorio))[2]
    salida(opciones)

    # Seleccionamos solo las opciones .csv

    xml = list()

    for file in opciones:
        if file[-4:] == ".xml":
            xml.append(file)

    archivos = e.multchoicebox(msg="Seleccione los archivos a transformar", title="Seleccion de archivos", choices=xml)
    salida(archivos)

    xlsx = list()

    for file in opciones:
        if file[-5:] == ".xlsx":
            xlsx.append(file)

    paraDict = e.choicebox(msg="Seleccionar libres", title="Seleccione el archivo de libres", choices=xlsx)
    salida(paraDict)

    wb = load_workbook((directorio + "%s" + paraDict) % "\\\\")
    ws = wb.active

    actual = 1
Пример #38
0
def setup():
    
    msg = ("Welcome to the new employee notification tool.\n"
           "The tool allows you to send customized automated emails "
           "that contain information about all ActiveDirectory users "
           "created within the last 24h.\n"
           "You will be asked several questions and config filters. "
           "Searches may take a few seconds to complete.\n"
           )
    msg2 = ("\nPlease create a new filter or load an existing filter "
            "which you can then modify."
            )
    cfgs = os.listdir(cfgdir)
    if len(cfgs)==0:
        msg2 = ''
        easygui.msgbox(msg,__app__)
        pick='New Config'
    else:        
        pick = easygui.buttonbox(msg+msg2, __app__, ['New Config','Load Existing',
                                                     'Cancel'])
    if pick == 'Cancel':
        return False
    
    if pick != 'New Config':
        config = easygui.choicebox("Select an existing config:",__app__,cfgs)
        if not config:
            return False
        cfg = Settings(os.path.join(cfgdir,config))
        cfg.restore
    else:
        config=''
        while config == '':
            config = easygui.enterbox('Saving this filter. Please enter a name for this notification.', __app__)
            if not config:
                sys.exit()
        config=config.replace(' ','_')
        if not config.endswith('.txt'):
            config=config+'.txt'            
        cfg = Settings(os.path.join(cfgdir,config))
        cfg.store()    # persist the settings
        
        msg = ("Please select employee information you would like to filter.\n"
               "For example if you want to know about new staff in specific departments "
               "please pick 'Departments'. If you want to know about new users "
               "reporting to specific managers please pick 'Managers'. "
               "If you'd like to check for new users in specific Divisions and optionally "
               "filter by certain job titles please pick 'Divisions/Jobtitles'"
               )
        choi = [ "Departments", "Managers", "Divisions/Jobtitles" ]
        choival = [ "department", "manager", "division" ]

        pick = easygui.buttonbox(msg, __app__, choi)
        if not pick:
            return False
        idx = choi.index(pick)
        
        cfg.filter1=getUserAttrList (choival[idx])
        cfg.filter1_attr=choival[idx]

    cfg.filter1=easygui.multchoicebox(msg,"Select values from %s" % pick,cfg.filter1)
    if cfg.filter1_attr == 'division':
        alist=getUserAttrList ('title')
        filter2_attr='title'
        filter2=easygui.multchoicebox(msg,"Select values from 'Jobtitile'",alist)
    else:
        cfg.filter2_attr=''
        cfg.filter2=''

    msg = ("Please enter one or multiple email addresses (separated by comma) "
           "to which you want to send a notification when new users arrive"
           )
    cfg.to = easygui.enterbox(msg, __app__,cfg.to)


    msg = ("Please enter the email body you want to use for your notification "
           "email. A list of new users will be added below this text."
           )
    cfg.mailbody = easygui.textbox(msg, __app__, cfg.mailbody, codebox=False)

    msg = ("Optional: Please enter the command line of a script including full path "
           "and command options. This script will be executed when new users arrive.\n"
           "(Please leave this line empty to not execute anything.)"
           )
    cfg.run = easygui.enterbox(msg, __app__,cfg.run)
    
    cfg.store()    # persist the settings

    
    testdate=''
    out=''
    while True:
        if easygui.boolbox('Do you want to test this configuration (again) ?', __app__, ('Yes', 'No')):
            msg = ("If you want to test this config, please enter the creation date "
                         "(format: YYYYMMDD) you would like to test."
                        )
            testdate = easygui.enterbox(msg, __app__,testdate)
            if not testdate:
                break
            if testdate != '':
                exe=getMyFile()
                try:
                    out=subprocess.check_output(
                        '"%s" --debug --search-date %s %s' % (exe,testdate,config),
                        stderr=subprocess.STDOUT,
                        shell=True)
                except :
                    print "likely subproces CalledProcessError.output "
                easygui.codebox('Please see debugging output below:', __app__, out)
        else:
            break

    cmdline = '%s %s' % (getMyFile(),config)
    easygui.codebox('Please activate this command via cron:' , __app__,cmdline)
# Now ask the user to put in the identities of the digital inputs
identities = easygui.multenterbox(msg = 'Put in the identities of the digital inputs (only integers)', fields = [train._v_name for train in trains_dig_in])
for i in range(len(identities)):
	identities[i] = int(identities[i])

# Get the palatability/identity calculation paramaters from the user
params = easygui.multenterbox(msg = 'Enter the parameters for palatability/identity calculation', fields = ['Window size (ms)', 'Step size (ms)'])
for i in range(len(params)):
	params[i] = int(params[i])

# Get the pre-stimulus time from the user
pre_stim = easygui.multenterbox(msg = 'Enter the pre-stimulus time for the spike trains', fields = ['Pre stim (ms)'])
pre_stim = int(pre_stim[0])

# Ask the user about the type of units they want to do the calculations on (single or all units)
unit_type = easygui.multchoicebox(msg = 'Which type of units do you want to use?', choices = ('All units', 'Single units', 'Multi units', 'Custom choice'))
all_units = np.arange(trains_dig_in[0].spike_array.shape[1])
single_units = np.array([i for i in range(len(all_units)) if hf5.root.unit_descriptor[i]["single_unit"] == 1])
multi_units = np.array([i for i in range(len(all_units)) if hf5.root.unit_descriptor[i]["single_unit"] == 0])
chosen_units = []
if unit_type[0] == 'All units':
	chosen_units = all_units
elif unit_type[0] == 'Single units':
	chosen_units = single_units
elif unit_type[0] == 'Multi units':
	chosen_units = multi_units
else:
	chosen_units = easygui.multchoicebox(msg = 'Which units do you want to choose?', choices = ([i for i in all_units]))
	for i in range(len(chosen_units)):
		chosen_units[i] = int(chosen_units[i])
	chosen_units = np.array(chosen_units)
hf5 = tables.open_file(hdf5_name, 'r+')

# Get electrode number from user
electrode_num = easygui.multenterbox(msg = 'Which electrode do you want to choose? Hit cancel to exit', fields = ['Electrode #'])
electrode_num = int(electrode_num[0])
	
# Get the number of clusters in the chosen solution
num_clusters = easygui.multenterbox(msg = 'Which solution do you want to choose for electrode %i?' % electrode_num, fields = ['Number of clusters in the solution'])
num_clusters = int(num_clusters[0])

# Load data from the chosen electrode and solution
spike_waveforms = np.load('./spike_waveforms/electrode%i/spike_waveforms.npy' % electrode_num)
predictions = np.load('./clustering_results/electrode%i/clusters%i/predictions.npy' % (electrode_num, num_clusters))

# Get cluster choices from the chosen solution
clusters = easygui.multchoicebox(msg = 'Which clusters do you want to choose?', choices = tuple([str(i) for i in range(int(np.max(predictions) + 1))]))
for i in range(len(clusters)):
	clusters[i] = int(clusters[i])

# Get the current plot data
plot_data = []
for cluster in clusters:
	plot_data.append(np.where(predictions == cluster)[0])
plot_data = spike_waveforms[plot_data]

# Set up data
N = 0
x = np.arange(len(plot_data[N])/10)
y = spike_waveforms[0, ::10]
source = ColumnDataSource(data=dict(xs=[x for i in range(50)], ys = [plot_data[N + i, ::10] for i in range(50)]))
Пример #41
0
# Look for the hdf5 file in the directory
file_list = os.listdir('./')
hdf5_name = ''
for files in file_list:
	if files[-2:] == 'h5':
		hdf5_name = files

# Open the hdf5 file
hf5 = tables.open_file(hdf5_name, 'r+')

# Now ask the user to put in the identities of the digital inputs
trains_dig_in = hf5.list_nodes('/spike_trains')
identities = easygui.multenterbox(msg = 'Put in the taste identities of the digital inputs', fields = [train._v_name for train in trains_dig_in])

# Ask what taste to plot
plot_tastes = easygui.multchoicebox(msg = 'Which tastes do you want to plot? ', choices = ([taste for taste in identities]))
plot_tastes_dig_in = []
for taste in plot_tastes:
    plot_tastes_dig_in.append(identities.index(taste))

# Ask the user for the pre stimulus duration used while making the spike arrays
pre_stim = easygui.multenterbox(msg = 'What was the pre-stimulus duration pulled into the spike arrays?', fields = ['Pre stimulus (ms)'])
pre_stim = int(pre_stim[0])

# Get the psth paramaters from the user
params = easygui.multenterbox(msg = 'Enter the parameters for making the PSTHs', fields = ['Window size (ms)', 'Step size (ms)'])
for i in range(len(params)):
	params[i] = int(params[i])

# Ask the user about the type of units they want to do the calculations on (single or all units)
chosen_units = []
Пример #42
0
    starts_stops=[]
    for starts in starts_of_down[0]:
        i=starts
        while filtered_signal[i]<0 and i<len(filtered_signal):
            i+=1
        stops=i
        starts_stops.append([starts,stops])
    starts_stops=np.array(starts_stops)
    return starts_stops

directory=r'C:\Users\colorbox\Documents\benca3stuff'
file_list_opts=read_and_parse(directory)
msg ="Files to explore?"
title = "File exploration system"
choices = file_list_opts[0][1:]
choice = eg.multchoicebox(msg, title, choices)
for file in choice:
    fs=20000
    highcut=1000
    lowcut=6
    input_array2=np.genfromtxt(os.path.join(directory,file),delimiter=',')
    filtered_signal=butter_bandpass_filter(input_array2,lowcut,highcut,fs,order=2)
    seconds=len(filtered_signal)/fs
    bins=np.round(seconds/10)
    file_vars=1
    threshold=0
    while file_vars:
        msg = "Fill out opts cancel goes to next file"
        title = "Slice and thresh"
        fieldNames = ["Slice number max = "+str(bins),"thresh"]
        file_vars = ['',threshold]  # we start with blanks for the values
Пример #43
0
def main():
    """The main function that makes the dialogs work."""
    global package
    di = {}
    box = easygui.multenterbox(
        msg='Fill in as many fields as possible. The first 3 are required.',
        title='Setup.py Creation',
        fields=choices)
    none_check(box)
    for i in range(len(choices)):
        if i != 1:
            di[choices[i]] = box[i]
    version_string = 'version = \'{}\''.format(box[1])
    classifiers_chosen = easygui.multchoicebox(
        msg='Pick the classifiers you want to use',
        title='Classifiers',
        choices=clist)
    none_check(classifiers_chosen)
    classifiers_list = classifiers_chosen
    classifiers_str = str(classifiers_chosen)
    classifiers_string = 'classifiers = ' + classifiers_str
    install = easygui.textbox(
        msg=
        'Enter in packages along with their version info. Place one per line.',
        title='Packages')
    none_check(install)
    # noinspection PyTypeChecker
    packages = install.split('\n')
    package_list = packages
    package_str = str(packages)
    package = 'requirements = ' + package_str
    write = """from setuptools import setup, find_packages
packages = find_packages()    
{}    
{}
{}
setup(""".format(classifiers_string, package, version_string)
    for key in di:
        if not di[key]:
            pass
        else:
            write += '{}=\'{}\','.format(key, di[key])
            if key == 'name':
                write += 'version = version,'

    write += 'packages = packages'
    if not (len(package_list) == 1 and package_list[0] == ''):
        write += ', requirements = requirements'
    if not (len(classifiers_list) == 1 and classifiers_list[0] == ''):
        write += ', classifiers = classifiers'
    write += ')'
    if os.path.exists('setup.py'):
        with open('setup.py', 'r') as file:
            with open('setup.py.old', 'w') as file2:
                file2.write(file.read())
    with open('setup.py', 'w') as file:
        file.write(write)
    try:
        with open('.gitignore', 'r') as file:
            pass
        with open('gitignore', 'a+') as file:
            if 'setup.py.old' in file.read():
                pass
            else:
                file.write('\n#Old setup.py files\nsetup.py.old')
    except FileNotFoundError:
        pass
    cmds = [
        'build',
        'build_py',
        'build_ext',
        'build_clib',
        'build_scripts',
        'clean',
        'sdist',
        'check',
        'bdist_wheel',
        'bdist_egg',
    ]
    build = easygui.multchoicebox(msg='Choose commands to run',
                                  title='Running setup.py commands',
                                  choices=cmds)
    none_check(build)
    setupscripts = 'python setup.py '
    for entry in build:
        setupscripts += entry + ' '
    import subprocess
    subprocess.run(setupscripts)
    up = easygui.multpasswordbox(
        'Enter username and password to upload tp PyPi.',
        title='Username & Password',
        fields=['username', 'password'])
    none_check(up)
    username, password = up
    cmd2 = 'python -m twine upload -u {} -p {} dist\\*'.format(
        username, password)
    subprocess.run(cmd2)
    return 0
Пример #44
0
def ShowOptions(option_list, title, header):
    choice = eg.multchoicebox(header, title, option_list)
    return choice
Пример #45
0
}  #这个是在fiddler中查看到的
raw_postdata["keyboard"] = easygui.enterbox("输入要搜索的动漫,注意字不能错哦",
                                            default="进击的巨人")
postdata = urllib.parse.urlencode(raw_postdata).encode('utf-8')
req = urllib.request.Request(url, postdata)
req.add_header(
    "User-Agent",
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36"
)
data = urllib.request.urlopen(req).read().decode()
# print(data)           #搜索时post之后返回的数据
search_data = re.compile('<h3><a href="/anime.*</a></h3>').findall(data)
search_data_name = []
search_data_url = []
j = 0
for i in search_data:
    search_data_url.append("http://www.silisili.me/anime" +
                           search_data[j].split("anime")[1].split('.html')[0] +
                           ".html")
    search_data_name.append(search_data[j].split('">')[1].split('</a><')[0])
    j += 1

name_choice = easygui.multchoicebox(
    msg="选择你需要的结果,注意只能选择一个哦", title='搜索结果',
    choices=search_data_name)  #名字显示并选择,注意这里只能选择一个
# print(name_choice)     #搜索结果中名字的列表
choice_location = search_data_name.index(
    name_choice[0])  #查询选择的结果在名字列表中处于第几个,然后在url列表中调用该参数
# print(choice_location)
url_needed_first = search_data_url[choice_location]
# print(url_needed_first)   #最终需要的url
    feedoptions = []
    feedorder = []
    for feed in sorted(feeds):
        feedoptions.append(feed.ljust(42) + ": " + feed_descriptions[feed])
        feedorder.append(feed)
    answer = g.choicebox(
        '\n'.join([
            'Choose a feed you would like to download data from.',
            'Note: you have to be a subscriber of that.'
        ]), windowtitle, feedoptions)
    if answer is None:
        exit(6)
    feedno = feedoptions.index(answer)
    args['feed'] = feedorder[feedno]
    if len(formatmatrix[args['feed']]) > 2:
        answer = g.multchoicebox('Choose the preferred data format(s)',
                                 windowtitle, formatmatrix[args['feed']])
        if answer is None:
            exit(6)
        args['dataformats'] = answer
    else:
        args['dataformats'] = formatmatrix[args['feed']]
        g.msgbox(
            "The feed supports a single data format: %s.\nData will be downloaded in this format."
            % args['dataformats'][0])

    # Start initializing feed
    feeds = []
    for dataformat in args['dataformats']:
        the_feed = wdf.WhoisDataFeed()
        the_feed.set_no_resume(args['no_resume'])
        the_feed.set_feed_type(FEEDCONFIGDIR, args['feed'], dataformat)
# Neo structures files in segments - we mostly have only 1 segment in our Plexon recordings. Read that segment
seg = reader.read_segment()

# Get the event names in this recording (corresponds to digital inputs) - ask the user which ones to use to splice the spike trains into trials
check = easygui.ynbox(msg = 'Digital input channels: ' + str([event.annotations['channel_name'] for event in seg.events]) + '\n' + 'No. of trials: ' + str([event.times.shape for event in seg.events]), title = 'Check and confirm the number of trials detected on digital input channels')

# Go ahead only if the user approves by saying yes
if check:
	pass
else:
	print("Well, if you don't agree, blech_clust can't do much!")
	sys.exit()

# Ask the user which digital input channels should be used for getting spike train data, and convert the channel numbers into integers for pulling spikes out
dig_in_pathname = [event.annotations['channel_name'] for event in seg.events]
dig_in_channels = easygui.multchoicebox(msg = 'Which digital input channels should be used to produce spike train and emg data (if it exists) trial-wise?', choices = ([event.annotations['channel_name'] for event in seg.events]))
dig_in_channel_nums = []
for i in range(len(dig_in_pathname)):
	if dig_in_pathname[i] in dig_in_channels:
		dig_in_channel_nums.append(i)

# Ask the user for the pre and post stimulus durations to be pulled out, and convert to integers
durations = easygui.multenterbox(msg = 'What are the signal durations pre and post stimulus that you want to pull out', fields = ['Pre stimulus (ms)', 'Post stimulus (ms)'])
for i in range(len(durations)):
	durations[i] = int(durations[i])

# Delete the spike_trains node in the hdf5 file if it exists, and then create it
try:
	hf5.remove_node('/spike_trains', recursive = True)
except:
	pass
Пример #48
0
    first_file_df = pd.read_csv(first_file, sep="\t")
except UnicodeDecodeError:
    first_file_df = pd.read_csv(first_file, sep="\t", encoding='cp1252')
except:
    eg.msgbox(msg="Sorry, we're having trouble parsing %s" % first_file, title=title)

second_file = eg.fileopenbox (msg="Select your second file", title=title,default="*.txt")
try:
    second_file_df = pd.read_csv(second_file, sep="\t")
except UnicodeDecodeError:
    second_file_df = pd.read_csv(second_file, sep="\t", encoding='cp1252')
except:
    eg.msgbox(msg="Sorry, we're having trouble parsing %s" % second_file, title=title)

cols = first_file_df.columns
text_cols = eg.multchoicebox(msg="Select the text fields", title=title, choices=cols)
number_cols = eg.multchoicebox(msg="Select the number fields", title=title, choices=cols)
on = eg.multchoicebox(msg="Select the unique field(s)", title=title, choices=cols)
xref = on[0]

missing_in_first_df = second_file_df[~second_file_df[xref].isin(first_file_df[xref])]
missing_in_first = second_file_df[~second_file_df[xref].isin(first_file_df[xref])][xref]

missing_in_second_df = first_file_df[~first_file_df[xref].isin(second_file_df[xref])]
missing_in_second = first_file_df[~first_file_df[xref].isin(second_file_df[xref])][xref]

universe_diffs = pd.concat([missing_in_first, missing_in_second])

first_file_root = first_file.split('\\')[-1][:-4]
second_file_root = second_file.split('\\')[-1][:-4]
		changes.append(on_times[-1]) # append the last trial which will be missed by this method
	except:
		pass # Continue without appending anything if this port wasn't on at all
	change_points.append(changes)	

# Show the user the number of trials on each digital input channel, and ask them to confirm
check = easygui.ynbox(msg = 'Digital input channels: ' + str(dig_in_pathname) + '\n' + 'No. of trials: ' + str([len(changes) for changes in change_points]), title = 'Check and confirm the number of trials detected on digital input channels')
# Go ahead only if the user approves by saying yes
if check:
	pass
else:
	print("Well, if you don't agree, blech_clust can't do much!")
	sys.exit()

# Ask the user which digital input channels should be used for slicing out EMG arrays, and convert the channel numbers into integers for pulling stuff out of change_points
dig_in_channels = easygui.multchoicebox(msg = 'Which digital input channels should be used to slice out EMG data trial-wise?', choices = ([path for path in dig_in_pathname]))
dig_in_channel_nums = []
for i in range(len(dig_in_pathname)):
	if dig_in_pathname[i] in dig_in_channels:
		dig_in_channel_nums.append(i)

# Ask the user for the pre and post stimulus durations to be pulled out, and convert to integers
durations = easygui.multenterbox(msg = 'What are the signal durations pre and post stimulus that you want to pull out', fields = ['Pre stimulus (ms)', 'Post stimulus (ms)'])
for i in range(len(durations)):
	durations[i] = int(durations[i])

# Grab the names of the arrays containing emg recordings
emg_nodes = hf5.list_nodes('/raw_emg')
emg_pathname = []
for node in emg_nodes:
	emg_pathname.append(node._v_pathname)
Пример #50
0
import easygui as g
ls = g.multchoicebox(msg="请选择购买的商品",
                     title="",
                     choices=('1.matebook13s:2000', '2.无线耳机:150', '3.蓝牙鼠标:30',
                              '4.鼠标垫:10', '5.双肩包:80'))
print(ls)
g.msgbox(ls)
Пример #51
0
Файл: gui.py Проект: Sudoka/SWAG
def main():
  reply = eg.boolbox(msg='Hello, do you have a pre-computed classifier?', choices=('Yes', 'No'))
  if reply == 1:
    filename = eg.fileopenbox(msg='Please specificy cached classifier file ending in .clfr')
    model = utils.load_classifiers(filename)
    reply = eg.boolbox(msg='Now that we have specified our classifier, we must now specify data to be classified. Are you ready to proceed?', choices=('Yes', 'No'))
    if reply == 0:
      sys.exit()
    filename = eg.fileopenbox(msg='Please specify data to be classified.')
    D = utils.parse_data(filename)
    outfilename = ''.join(filename.split('.')[:-1]) + '.lbls'
    print 'Classifying data...'
    with open(outfilename, 'w') as f:
      for d in D:
        f.write(str(model.classify_vector(d)))
        f.write('\n')
    print 'Done!'

  else:
    filename = eg.fileopenbox(msg='Please specify training data for your classifier')
    D = utils.parse_data(filename)
    reply = eg.boolbox(msg='Would you like to engage in manual or automatic construction of your classifier?', choices=('Manual', 'Automatic'))
    #manual selection
    if reply == 1:
      algs = eg.multchoicebox(msg='Please choose at least one algorithm:', choices=('k-Nearest Neighbors', 'Support Vector Machine', 'Naive Bayes'))
      alg_params = {alg : 'auto' for alg in algs}
      #storage for set of classifiers
      C = []
      for alg in algs:
        reply = eg.boolbox(msg='Would you like to engage in manual or automatic parameter tuning for your ' + alg + ' algorithm?', choices=('Manual', 'Automatic'))
        if reply == 1:
          if alg[0] == 'k':
            params = eg.multenterbox(msg='Please select the following parameters for your ' + alg + ' algorithm:', fields=('k'), values=['1'])
            print 'Building ' + alg + ' classifier...'
            C.append(cl.kNN(D, k=int(params[0])))
            print 'Done!\n'
          if alg[0] == 'S':
            reply = eg.boolbox(msg='What type of kernel would you like to use for your Support Vector Machine?', choices=('Radial Basis Function', 'Linear'))
            if reply == 1:
              params = eg.multenterbox(msg='Please select the following parameters for your RBF Support Vector Machine:', fields=('margin', 'gamma'), values=['1.0', '1.0'])
              print 'Building ' + alg + ' classifier...'
              C.append(cl.SVM(D, kernel_type='RBF', margin=float(params[0]), gamma=float(params[1])))
              print 'Done!\n'
            else:
              params = eg.enterbox(msg='Please select the margin parameter for your Linear Support Vector Machine:', default='1.0')
              print 'Building ' + alg + ' classifier...'
              C.append(cl.SVM(D, kernel_type='Linear', margin=float(params[0])))
              print 'Done!\n'
          if alg[0] == 'N':
            params = eg.enterbox(msg='Please select the binning threshold parameter for your Naive Bayes algorithm:', default='.01')
            print 'Building ' + alg + ' classifier...'
            C.append(cl.NB(D))
            print 'Done!\n'
            
        else:
          if alg[0] == 'k':
            print 'Building ' + alg + ' classifier...'
            C.append(cl.kNN(D))
            print 'Done!\n'
          if alg[0] == 'S':
            print 'Building ' + alg + ' classifier...'
            C.append(cl.SVM(D))
            print 'Done!\n'
          if alg[0] == 'N':
            print 'Building ' + alg + ' classifier...'
            C.append(cl.NB(D))
            print 'Done!\n'

      model = mcl.AdaBoost(C)

    #automatic selection
    else:
      print 'Constructing classifiers...'
      model = mcl.AdaBoost([cl.kNN(D), cl.SVM(D), cl.NB(D)])
      print 'Done!\n'

    reply = eg.boolbox(msg='Now that we have specified our classifier, we must now specify data to be classified. Are you ready to proceed?', choices=('Yes', 'No'))
    if reply == 0:
      sys.exit()
    filename = eg.fileopenbox(msg='Please specify data to be classified.')
    D = utils.parse_data(filename)
    outfilename = ''.join(filename.split('.')[:-1])
    print 'Classifying data...'
    with open(outfilename + '.lbls', 'w') as f:
      for d in D:
        f.write(str(model.classify_vector(d)))
        f.write('\n')
    print 'Done!'
    #cache our classifier
    utils.store_classifiers(outfilename + '.clfr', model)
    #give user some information on classifiers used
    open(outfilename + '.info', 'w').write(model.get_info())
Пример #52
0
def askCollectionSelection(collectionsList):													#Ask for the collections to conduct operations on
	msg = "Select the collections to conduct operations on:"
	selColList = eg.multchoicebox(msg,"Collections",collectionsList)
	if selColList is None:
		quit() 
	return selColList
Пример #53
0
import random
import easygui as g
import itchat as c
login=g.boolbox("欢迎使用狼人杀发牌助手\n继续进程需要登录您的微信网页版\n确认登录微信吗?")
if login==True:
    c.login()
    player=['filehelper']
    playersname=['Andy周勉','Leo','Andy Liu','Esther','Jack','Hagrid周文哲','Tania','刘嘉鹏']
    #allfriends=c.get_friends(update=True)[0:]
    #playersname=[]
    #for i in range(len(allfriends)):
        #playersname.append(allfriends[1][Name])
    msg="Choose the players"
    title="Setting"
    playerlist=g.multchoicebox(msg=msg,title=title,choices=playersname)
    for i in range(len(playerlist)):
        user = c.search_friends(name=playerlist[i])
        uname = user[0]['UserName']
        player.append(uname)
    msg="设置各身份人数:(除上帝外共"+str(len(playerlist))+"人)"
    title="设置"
    fields=["设置村民数量:","设置女巫数量:","设置猎人数量:","设置预言家数量:","设置守卫数量:","设置白痴数量:","设置狼人数量:","设置白狼王数量"]
    cardnumber=[0,0,0,0,0,0,0,0]
    while sum(cardnumber)!=len(playerlist):
        cardnumberp=g.multenterbox(msg=msg,title=title,fields=fields)
        for i in range(len(cardnumberp)):
            cardnumber[i]=int(cardnumberp[i])
        msg+="\n输入身份数须与人数相符!"
    villagernumber = cardnumber[0]
    sorceressnumber = cardnumber[1]
    hunternumber = cardnumber[2]
Пример #54
0
            self.spots_diameter[i] = full_data[row][25]
            self.spots_quality[i] = full_data[row][27]


DATABASE_DIR = 'O:\\protons\\Work in Progress\\Callum\\AccessDatabase\\AssetsDatabase_beCG.accdb'
pswrd = ''
conn = pypyodbc.connect('Driver={Microsoft Access Driver (*.mdb, *.accdb)};'
                        'DBQ=' + DATABASE_DIR + ';' + pswrd)
cursor = conn.cursor()

# Produce list of energies for multchoicebox - could be linked to Database?
energy_options = [x for x in list(range(70, 245, 5)) + [244]]

# Select acquired energies
energies = eg.multchoicebox(
    'Select Energies', 'Please select the energies that '
    'have spot pattern image files', energy_options)
energies = sorted([int(i) for i in energies], reverse=True)
print(f'Energies acquired: {energies}\n')

# Select Operator from list in Database
cursor.execute('select * from [Operators]')
operators = [row[2] for row in cursor.fetchall()]
operator = eg.choicebox('Who performed the measurements?', 'Operator',
                        operators)
if not operator:
    eg.msgbox('Please re-run the code and select an Operator')
    raise SystemExit
print(f'Operator = {operator}\n')

# Select Gantry from list in Database
Пример #55
0
 def _multpasswordbox(msg='', title=''):
     return eg.multchoicebox(msg, title)
Пример #56
0
def search_index():
    #============================================================
    # Define constants
    #============================================================
    mJup = 1.89813e30
    AU = 1.49597871e13

    #============================================================
    # Read in the index file (data) as (to) a python table
    #============================================================
    path_to_index_file = '/Volumes/Data/Work/Research/BodenheimerCode/Code_for_Kozai/outputs/SIMULATION_INDEX.txt'
    #index_data = atpy.Table(path_to_index_file,type='ascii',masked=True)
    index_data = atpy.Table(path_to_index_file,type='ascii')
    dates = pd.to_datetime(index_data.DateCreated)

    #============================================================
    # Get a list of all the parameter/column names available to sort on
    #============================================================
    param_list = index_data.columns.keys
    kozai_indices = (0,47,48,49,50,51,52,54,55,56,57)
    kozai_params = map(param_list.__getitem__,kozai_indices)
    kozai_params.append('MinNumResults')

    other_var_indices = []
    for i in range(len(param_list)):
        if i not in kozai_indices:
            other_var_indices.append(i)
    other_params = map(param_list.__getitem__,other_var_indices)

    #============================================================
    ## Load the index data into a data frame (for database querying/searching later on)
    #============================================================
    full_data = pd.DataFrame(index_data[::],index=dates)
    full_data = full_data.sort()

    #============================================================
    # Create the 'selected data' copy of the full data dataframe.
    #============================================================
    selected_data = full_data

    #============================================================
    # Open a GUI window that displays all the params available to sort on
    #============================================================
    sort_params1 = []
    sort_params2=[]
    sort_params1 = eg.multchoicebox(msg='Pick the KOZAI params to sort on',choices = kozai_params)
    #sort_params2 = eg.multchoicebox(msg='Pick the other params to sort on',choices = other_params)
    sort_params = sort_params1 + sort_params2

    #============================================================
    # Ask the user for min/max or 'contains string' criteria on all the selected fields
    #============================================================
    for item in range(len(sort_params)):
        
        if sort_params[item] == 'Path':
            #        thing = raw_input('File path contains: ')
            thing = eg.enterbox('File path contains: ')
            selected_data = selected_data[selected_data.Path.str.contains(thing)]
        
        elif sort_params[item] == 'DateCreated':
            minDate = eg.enterbox(msg='Enter the earliest date (yyyy-mm-dd):')
            maxDate = eg.enterbox(msg='Enter latest date (yyyy-mm-dd):',default=minDate)
            selected_data = selected_data[minDate:maxDate]
            print 'minDate: ',minDate,' maxDate: ',maxDate

        elif sort_params[item] == 'Zmass':
            foo = sort(selected_data.drop_duplicates('Zmass').Zmass.values)
            min = eg.indexbox(msg = 'Minimum mass value, in units of Mjup',choices = foo/mJup)
            max = min + eg.indexbox(msg = 'Maximum mass value, in units of Mjup',choices = foo[min::]/mJup)
            min = foo[min]
            max = foo[max]
            selected_data = selected_data[(selected_data[sort_params[item]] <= max) & (selected_data[sort_params[item]] >= min)] 
            print min," <= Zmass <= ",max

        elif sort_params[item] == 'SEMI':
            foo = sort(selected_data.drop_duplicates('SEMI').SEMI.values)
            min = eg.indexbox(msg='Minimum semi-major axis value, in AU',choices=foo/AU)
            max = eg.indexbox(msg='Maximum semi-major axis value, in AU',choices=foo/AU)
            min = foo[min]
            max = foo[max]
            selected_data = selected_data[(selected_data[sort_params[item]] <= max) & (selected_data[sort_params[item]] >= min)] 
            print min," <= SEMI <= ",max

        elif sort_params[item] == 'MinNumResults':
            min = eg.enterbox(msg='Enter the minimum number of results each simulation should have',default=1)
            values = map(check_num_sims_in_dir,selected_data.Path.values, [1*int(min)]*int(len(selected_data)) )
            selected_data = selected_data[values]
            print 'Minimum number of converged models required: ',min
        else:
            foo = sort(selected_data.drop_duplicates(sort_params[item])[sort_params[item]].values)
            min = eg.indexbox(msg='Minimum '+sort_params[item]+' value',choices=foo)
            max = eg.indexbox(msg='Maximum '+sort_params[item]+' value',choices=foo)
            min = foo[min]
            max = foo[max]
            selected_data = selected_data[(selected_data[sort_params[item]] <= max) & (selected_data[sort_params[item]] >= min)] 
            print min," <= ",sort_params[item]," <= ",max



            result = []
            #            print '\n+++++++++++++++++++++++++++'

    if len(selected_data) < 1:
        print 'No simulations match your requirements'
        print '+++++++++++++++++++++++++++\n'
    else:
        print str(len(selected_data))+ ' simulations meet these requirements'
        #    print 'Enter \'print result\' to see them!'
        #    print '+++++++++++++++++++++++++++'
        #    result = selected_data.Path.values
        #    result = result.tolist()

    return selected_data
    goodgame = g.buttonbox('which game do you think is the best one?','choose',('game1','game2','game3'))
    if str(goodgame) == 'game1':
        g.msgbox('you choose the game1 is the best one!')
    if str(goodgame) == 'game2':
        g.msgbox('you choose the game2 is the best one!')
    if str(goodgame) == 'game3':
        g.msgbox('you choose the game3 is the best one!')

    index1 = g.indexbox('indexboxtest','indexibox',('yes','no'))
    if index1 == 0:
        g.msgbox('indexbox choose yes')
    if index1 == 1:
        g.msgbox('indexbox choose no')
        

    a = g.multchoicebox('multchoicebox test','multchoicebox',['game1','game2','game3','game4'])
    if a == None:
        print(a)
        a = ['meiyou']
        print(type(a))
    try:
        b = list(g.multchoicebox('multchoicebox test','multchoicebox',a))
    except:
        g.exceptionbox()
    
    
    if g.ccbox('continue the game?','please choose'):
        pass
    else:
        sys.exit(0)
Пример #58
0
from moodleFunction import *
import urllib, urllib2, cookielib
from bs4 import BeautifulSoup
import easygui as eg
import os
import pickle

url="http://moodle.iitb.ac.in"
opener = moodleLogin()

courseList = getCourseList(opener,url)
try:
    f = open('course','r')
    choice = f.read().splitlines()
except IOError:
    choice =eg.multchoicebox("Courses to Sync","MoodleSync",courseList.keys())
    f = open('course','w')
    f.write("\n".join(choice))
    f.close()


cList ={}
for course in choice:
    cList[course] = courseList[course]


for course in cList.items():
    print(course[0])
    dirName='MyCourses/'+ str(course[0])
    openHistory(dirName)
    if not os.path.exists(dirName):
Пример #59
0
def get_list_of_desired_messages(list_of_message_format_names):
    question = 'Please select the data to convert.'
    title = 'Convert .bin.log or .tlog to .csv.'
    choice = eg.multchoicebox(question, title, list_of_message_format_names)
    return choice
Пример #60
0
 def __init__(self,height,width,lvl): #temp
     print "Load game? " + str(consts.loadedGame)
     if consts.loadedGame==False: ##new game ##change true to 'consts.loadedGame==False'
         ##(cell,angle,carnivore,eggwithdraw,food,foodWithdraw,ID,lifeTime,location,speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength=0):
         self.screenheight=height
         self.screenwidth=width
         """
         self.myCell = classes.baseCell(None, angle, carnivor, eggwithdraw, p_food, foodWithdraw, 0, p_lifetime,
                                            classes.Location(400, 400), speed, rad, lifewithdraw, timeToLay, AI,
                                            vision, eggHatchTime, strength)
         """
         if lvl==1:#easy
             self.myCell = classes.baseCell(None, 0, 1, consts.framerate, 40, consts.framerate, 0, 40,
                                            classes.Location(400, 400), 3, 10, consts.framerate, 15, 2,
                                            200, 3, 10)
         if lvl==2:#lil harder
             self.myCell = classes.baseCell(None, 0, 0, consts.framerate, 40, consts.framerate, 0, 40,
                                            classes.Location(400, 400), 2, 10, consts.framerate, 20, 2,
                                            200, 3, 10)
         if lvl==3:#normal
             self.myCell = classes.baseCell(None, 0, 0, consts.framerate, 30, consts.framerate, 0, 40,
                                            classes.Location(400, 400), 1, 10, consts.framerate, 20, 2,
                                            200, 3, 5)
         if lvl==4:#hard
             self.myCell = classes.baseCell(None, 0, 0, consts.framerate, 20, consts.framerate, 0, 30,
                                            classes.Location(400, 400), 1, 10, consts.framerate, 25, 2,
                                            200, 3, 1)
         angle = 4
         lifewithdraw = consts.framerate
         carnivore = 0
         eggwithdraw = consts.framerate
         food = 30
         foodWithdraw = consts.framerate
         rad = 10
         AI = 2
         vision = 200
         lifeTime = 40
         p_lifetime = lifeTime
         p_food = food
         speed = 1
         timeToLay = 20
         eggHatchTime = 3
         strength = 5
         #                            cell,angle,carnivore,eggwithdraw,foodleft,foodwithdraw,ID,Lifetime,location,speed,rad,lifewithdeaw,timetolay,AI,vision,eggHatchtime,strngth
         #self.myCell=classes.baseCell(None,angle,1,eggwithdraw,p_food,foodWithdraw,0,p_lifetime,classes.Location(400,400),speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength)
         self.myCell.base90, self.myCell.base45 = pygame.image.load('src/IMG/HeadD.png'),pygame.image.load('src/IMG/HeadUL.png')
         self.myCell.image=self.myCell.base90
         self.cellList.append(classes.baseCell(None, angle, carnivore, eggwithdraw, food, foodWithdraw, 1, lifeTime,classes.Location(random.randint(0, self.screenwidth),random.randint(0, self.screenheight)), speed, rad,lifewithdraw, timeToLay, AI, vision, eggHatchTime, strength))
         self.cellList.append(classes.baseCell(None,angle,carnivore,eggwithdraw,food,foodWithdraw,2,lifeTime,classes.Location(random.randint(0,self.screenwidth),random.randint(0,self.screenheight)),speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength))
         self.cellList.append(classes.baseCell(None,angle,carnivore,eggwithdraw,food,foodWithdraw,3,lifeTime,classes.Location(random.randint(0,self.screenwidth),random.randint(0,self.screenheight)),speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength))
         self.cellList.append(classes.baseCell(None,angle,carnivore,eggwithdraw,food,foodWithdraw,4,lifeTime,classes.Location(random.randint(0,self.screenwidth),random.randint(0,self.screenheight)),speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength))
         self.cellList.append(classes.baseCell(None,angle,carnivore,eggwithdraw,food,foodWithdraw,5,lifeTime,classes.Location(random.randint(0,self.screenwidth),random.randint(0,self.screenheight)),speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength))
         self.cellList.append(classes.baseCell(None,angle,carnivore,eggwithdraw,food,foodWithdraw,6,lifeTime,classes.Location(random.randint(0,self.screenwidth),random.randint(0,self.screenheight)),speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength))
         self.cellList.append(classes.baseCell(None,angle,carnivore,eggwithdraw,food,foodWithdraw,7,lifeTime,classes.Location(random.randint(0,self.screenwidth),random.randint(0,self.screenheight)),speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength))
         self.cellList.append(classes.baseCell(None,angle,carnivore,eggwithdraw,food,foodWithdraw,8,lifeTime,classes.Location(random.randint(0,self.screenwidth),random.randint(0,self.screenheight)),speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength))
         self.cellList.append(classes.baseCell(None,angle,carnivore,eggwithdraw,food,foodWithdraw,9,lifeTime,classes.Location(random.randint(0,self.screenwidth),random.randint(0,self.screenheight)),speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength))
         self.cellList.append(classes.baseCell(None,angle,carnivore,eggwithdraw,food,foodWithdraw,10,lifeTime,classes.Location(random.randint(0,self.screenwidth),random.randint(0,self.screenheight)),speed,rad,lifewithdraw,timeToLay,AI,vision,eggHatchTime,strength))
         ##self.cellEggs[0].mixPlayerCells(self.myCell,self.myCell)
         #self.cellEggs.append(classes.Egg((100,100),self.cellList[0],None,6,0))
         self.putFood()
     else: ##later code goes here
         onlyfiles = [f for f in listdir("src/SAV") if isfile(join("src/SAV", f))]
         choice=easygui.multchoicebox("Pick savefile:","",onlyfiles)
         file_path = path.relpath("src/SAV/"+choice)
         file = open(file_path,"r")
         sp=file.read()
         spp=base64.urlsafe_b64decode(sp).split('\n')
         self.load(spp)
         file.close()
         self.myCell.base90, self.myCell.base45 = pygame.image.load('src/IMG/HeadD.png'),pygame.image.load('src/IMG/HeadUL.png')
         self.myCell.image=self.myCell.base90
     self.p2spaceLimiter=classes.spaceLimited(consts.screenwidth/2,0.05)