示例#1
0
def main():
	msg = "Start pomodoro-timing?"
	choices = ["Yes","No"]
	reply = g.buttonbox(msg, choices=choices)

	if reply == "Yes":
		title = "Please Confirm"
		print("25 minute work")
		timer(1500)
		choices = ["Yes","No","Long break!","Lunch"]
		while(True):
			#push("Pause")
			os.system('cls' if os.name == 'nt' else 'clear')
			reply = g.buttonbox("Worked for 25 min. Time for a break! \n Do you want to continue?" ,choices=choices)
			if reply == "Yes":
				print("5 min break")
				timer(300)
			elif reply == "Long break!":
				print("long break! coma back in 15 minutes!")
				timer(900)
			elif reply == "Lunch":
				print("Taking a 30 min lunch!")
				timer(1800)
			else:
				break
			
			push("Pause over! Get back to Work!")
			if g.ccbox("Five minute break over! Time to work the next 25 min! \n Do you want to continue?", title):
				print("sleeping for 25 minutes")
				timer(1500)
				#print(chr(27) + "[2J")
			else:  
				break
示例#2
0
 def __init__(self):
     login_title = "Login"
     login_msg = "Please input your email profile."
     login_info = [self.mail_server, self.ssl_port, "*****@*****.**", "cxl19960610"]
     login_field = ["Mail Server", "SSL Port", "User Name", "Password"]
     while True:
         #login_info = easygui.multpasswordbox(login_msg, login_title, login_field)
         #try:
         #    login_info[1] = int(login_info[1])
         #    if login_info[1] == '':
         #        os._exit(0)
         #    if login_info[1]<1 or login_info[1]>65535:
         #        raise Exception("Out of bound")
         #except Exception:
         #    easygui.buttonbox("SSL port must be a integer between 1 and 65535")
         #    continue
         self.mail_server = login_info[0]
         self.ssl_port = login_info[1]
         try:
             self.mail = imaplib.IMAP4_SSL(self.mail_server, self.ssl_port)
             self.mail.login(login_info[2], login_info[3])
         except Exception as reason:
             easygui.buttonbox("Login failure: " + str(reason), choices = ["Try Again"])
             continue
         break
示例#3
0
    def _save_file_dialogs(self, extension = "txt"):
        ''' Dialogs asking users to save file, sanity checks for existence of file, etc.

        extension is the file's extension (txt, png, etc). It will automatically be added
        to the filename specified by the user.

        The function returns the filename specified by the user if one is specified or
        None if the user cancels the operation for any reason.
        '''
        # If user cancels it defaults to the FIRST choice. We want default to be NO so I reverse the default of choices here. 
        saveornot = easygui.buttonbox(msg="Do you want to save results to a file?", choices = ("No", "Yes") )
        if saveornot == "Yes":
            filename = easygui.filesavebox(msg = "Where do you want to save the file (extension %s will automatically be added)?" %(extension))
            if filename is None:
                return None
            filename = filename + "." + extension
            if os.path.exists(filename):
                ok_to_overwrite = easygui.buttonbox(msg="File %s already exists. Overwrite?" %(filename), choices = ("No", "Yes") )
                if ok_to_overwrite == "Yes":
                    return filename
                else:
                    return None
            else:
                return filename
        else:
            return None
def UserPlay(TitleText):
    #Propts the user enter their guess
    ColorChosen = ["","","",""]
    easygui.msgbox(msg = "Enter Your Guesses in the boxes that follow ", title = TitleText +  " Guessing", ok_button = "Next")
    ColorChosen[0] = easygui.buttonbox(msg = "Pick the color for your 1st hole", title = TitleText + " Guessing", choices = ("Blue", "Green", "White", "Red", "Yellow", "Orange"))
    ColorChosen[1] = easygui.buttonbox(msg = "Pick the color for your 2nd hole", title = TitleText + " Guessing", choices = ("Blue", "Green", "White", "Red", "Yellow", "Orange"))
    ColorChosen[2] = easygui.buttonbox(msg = "Pick the color for your 3nd hole", title = TitleText + " Guessing", choices = ("Blue", "Green", "White", "Red", "Yellow", "Orange"))
    ColorChosen[3] = easygui.buttonbox(msg = "Pick the color for your 4nd hole", title = TitleText + " Guessing", choices = ("Blue", "Green", "White", "Red", "Yellow", "Orange"))
    return ColorChosen
示例#5
0
    def gameflow(player):
        while Game.status is True:
            player.lap += 1
            cats = list()

            for category in Game.questions:
                cats.append(category)
            title = "Jeopardy SuperCool de ICC"
            category = eg.choicebox(Game.getMessage(player), title, cats)
            if not category:
                break
            choices = list()
            for quest in Game.questions[category]['preguntas']:
                if not quest['answered']:
                    choices.append(quest['value'])

            image = "Assets/imagenes/" + category + ".gif"
            msg = "Selecciona el valor que quieres ganar"
            if len(choices) > 0:
                chosen = eg.buttonbox(msg, image=image, choices=choices)

            for quest in Game.questions[category]['preguntas']:
                if not quest['answered'] and quest['value'] == chosen:
                    msg = quest['Pregunta']
                    options = list()
                    for option in quest['opciones']:
                        options.append(option['opcion'])
                        try:
                            Correcta = option['Correcta']
                            Correcta = option['opcion']
                        except KeyError:
                            pass
                    random.shuffle(options)
                    reply = eg.buttonbox(msg, image=image, choices=options)
                    quest['answered'] = True
                    if reply == Correcta:
                        eg.msgbox(random.choice(Game.correctAnswers) + "\n\nHaz ganado $" + str(quest['value']),
                                  ok_button="seguir...")
                        player.right += 1
                        player.money += quest['value']
                    else:
                        eg.msgbox(random.choice(Game.incorrectAnswers) + "\nLa respuesta es:\n"
                                  + Correcta + "\n\nHaz perdido $" + str(Game.LooseMoney), ok_button="okaaaay :(");
                        player.mistakes += 1
                        player.money -= Game.LooseMoney

                if player.mistakes > Game.ErrorLimit or player.money < Game.MoneyLimit:
                    Game.status = False
                    eg.msgbox("Has perdido, este jeopardy es mucho para ti...\n\n" + Game.getMessage(player),
                              ok_button="byeeeee :(")
                    exit()
                if player.lap > Game.GameLimit and player.money > Game.MoneyLimit and player.mistakes < Game.ErrorLimit:
                    Game.status = False
                    Game.Win = True
        if Game.Win:
            eg.msgbox("Has Ganado, te mereces el respeto de un pythonista...\ny te llevas $"
                      + str(player.money) + "\n" + Game.getMessage(player), ok_button="Salir")
def reply(k):
    char1='Target has been destroyed!'
    char2='Missed!'
    image1 = "twilight_sparkle_win.png"
    image2 = "starlight_glimmer_great_shot.png"
    if k == 1:
        easygui.buttonbox(char1, image=image1, choices=['Continue'])
    if k == 2:
        easygui.buttonbox(char2, image=image2, choices=['Continue'])
示例#7
0
def askSaveAuto(readFromFiles=False, trained=False):
    if readFromFiles and trained:
        msg = "Do you wish to save these pictures automatically?\nYou might be asked if a person is new to the system or if the network fails to recognize someone 80% of the times."
        return eg.buttonbox(msg,"Save Pictures?", choices=('Yes', 'No', 'Cancel'))
    elif trained:
        msg = "Do you wish to save these pictures automatically?\nThe network must be retrained to classify the pictures in the correct folders. You might be asked if a person is new to the system or if the network fails to recognize someone 80% of the times."
        return eg.buttonbox(msg,"Save Pictures?", choices=('Yes', 'No', 'Cancel'))
    else:
        msg = "Do you wish to save the new pictures automatically? This might take some time since the network needs to be trained. You might be asked if a person is new to the system or if the network fails to recognize someone 80% of the times." 
        return eg.buttonbox(msg,"Save Pictures?", choices=('Yes', 'No', 'Cancel'))    
示例#8
0
def main(db):

    # ------------------
    # POPULATE CDMS LIST
    # ------------------
    pd.options.mode.chained_assignment = None
    print 'Pulling updates from CDMS...'
    update_list = pull_updates()
    choice_list = [CDMSChoiceList([str(i)]+update_list[i]) for i in range(len(update_list))]

    # RUN PROCESS

    CDMSLoop = True
    while CDMSLoop:
        cursor = db.cursor()

        choice = eg.choicebox("Choose a Molecule to Update", "Choice", choice_list)
        custom_cat_file = eg.buttonbox(msg='Would you like to supply a custom CAT file?', choices=['Yes', 'No'])
        if custom_cat_file == 'Yes':
            custom_path = eg.fileopenbox(msg='Please select a CAT file.', title='Custom CAT file')
            cat_entry = CDMSMolecule(update_list[int(choice[0:5])], custom=True, custom_path=custom_path)
        else:
            cat_entry = CDMSMolecule(update_list[int(choice[0:5])], custom=False)

        cmd = "SELECT * FROM species " \
            "WHERE SPLAT_ID LIKE '%s%%'" % str(cat_entry.tag[:3])

        cursor.execute(cmd)
        res = cursor.fetchall()
        splatmolresults = [SplatSpeciesResultList([i]+list(x)) for i, x in enumerate(res)]
        splatmolresults += [SplatSpeciesResultList([len(splatmolresults),999999999,0,'NEW MOLECULE',
                                                    'X', '', '', '', '', '', ''])]
        choice2 = eg.choicebox("Pick molecule from Splatalogue to update, or create a new molecule.\n "
                               "Current choice is:\n %s" % choice, "Splatalogue Search Results",
                               splatmolresults)
        cursor.close()

        if choice2[68] == 'X':
            linelist, species_final, metadata_final = new_molecule(cat_entry, db)
            push_molecule(db, linelist, species_final, metadata_final, update=0)

        else:  # Molecule already exists in Splatalogue database
            linelist, metadata_final = process_update(cat_entry, res[int(choice2[0:5])], db)
            push_molecule(db, linelist, {}, metadata_final, update=1)

        choice3 = eg.buttonbox(msg='Do you want to update another CDMS entry?', choices=['Yes', 'No'])

        if choice3 == 'No':
            CDMSLoop = False
示例#9
0
    def trigger(self):
        operation_ = easygui.buttonbox(title='YoDa by Yogi', msg='Choose the operation',
                                       choices=['Download', 'Link only', 'Settings', 'About', 'Update', 'Exit'])
        if not operation_ or operation_ == 'Exit':
            exit(0)
        if operation_ == 'About':
            abt_us = ("""\t\t          YoDa_v%s\n
This software downloads the videos and audios from almost all popular media sites using your download manager.
Developed by\t: Yogi
e-mail\t\t: acetheultimate(at)gmail(dot)com
Website\t\t: http://video.feedabyte.com
""") % __version__

            about_choice = easygui.buttonbox(title="YoDa by Yogi", msg=abt_us, choices=['Back', 'ReadMe', 'Exit'],
                                             image='icon.png')
            
            if about_choice == 'Back':
                self.trigger()
            if about_choice == 'ReadMe':
                os.startfile('ReadMe.txt')
                exit(0)
            else:
                exit(0)
            exit(0)
        if operation_ == 'Update':
            try:
                response = requests.get('http://devzone.pe.hu/YoDa/updates.php').text
                response = BeautifulSoup(response)
                self.download_address = response.find('a')
                self.download_address = 'http://devzone.pe.hu/YoDa'+self.download_address['href'][1:]
                qual = response.text.split(':')
                self.name = qual
                if qual[0] > 'YoDa_v'+__version__:
                    self.mode = 2
                else:
                    easygui.msgbox(title='YoDa by Yogi', msg='Voila! You are Up to Date :)')
                    exit(0)
            except requests.exceptions.ConnectionError:
                easygui.msgbox('Connection Error! Please check your internet connectivity')
                exit(0)
        if operation_ == 'Settings':
            configObj.update_config()
            exit(0)
        if operation_ == 'Download':
            self.mode = 0
        if operation_ == 'Link only':
            self.mode = 1
        self.path_selector()
示例#10
0
def getFile(world):
    b = easygui.buttonbox("","PyCraft: Select a World", ("Load World","New World","Quit"))
    if b == "Quit":
        logdata("The user quitted immediatly.")
        quit()
    if b == "New World":
        logdata("The user created a new world.")
        name = easygui.enterbox("Pick a name for your world: ")
        logdata("They named it '"+name+"'.")
        gens = os.listdir("generators/")
        for gen in range(len(gens)):
            gens[gen] = gens[gen][:-3]
        gen = easygui.choicebox("Select a world generator: ","",gens)
        logdata("They used the generator '"+gen+"'.")
        exec open("generators/"+gen+".py").read()
        generateRandomMap(world)
        
        world.saveName = name
    if b == "Load World":
        worlds = os.listdir("worlds/")
        world_name = easygui.choicebox("Select a world","Pycraft: Select a World", worlds)
        logdata("They loaded the world named '"+world_name+"'.")
        world_data = open("worlds/"+world_name,"r").read()
        logdata("It contains "+str(len(world_data.split("\n"))-1)+" blocks.")
        parseMap(world,world_data)
        world.saveName = world_name
示例#11
0
def quit_prompt(student_list):
    """Asks if the user wants to quit or not.
       If yes, saves the student_list as a CSV file.
    """
    if eg.ynbox("Cikmak istediginize emin misiniz?", choices=('Evet', 'Hayir')):
        csv_file = eg.filesavebox(title='Tabloyu kaydet',filetypes=['*.csv'])

        #Adds .csv extension if user did not already.
        if csv_file:
            if csv_file[-4:] != '.csv':
                csv_file += '.csv'

            with open(csv_file, 'wb') as f:
                writer = csv.writer(f, delimiter=';')
                writer.writerow(['AD', 'SOYAD', 'UNIVERSITE', 'OSYM PUANI', 'YILI',
                                 'CBUTF TABAN PUANI', 'NOT ORTALAMASI', 'SINIF',
                                 'EGITIM', 'DISIPLIN CEZASI', 'TELEFON', 'UYGUNLUK', 'PUAN'])
                student_list = sort_students(student_list)
                for student in student_list:
                    writer.writerow(student.export_for_csv())
            sys.exit(0)
        else:
            choice = eg.buttonbox(msg='Kaydetmeden cikmak istediginize emin misiniz?',
                                  title='Kaydetmeden cikis',choices=('Evet','Hayir'))
            if choice:
                sys.exit(0)
示例#12
0
def gamemenu():
    resolution = [640, 480]
    mode = 0
    msg = "Welcome player! Choose an option:"
    buttons = ["Finger", "Tool"]
    picture = None  # gif file
    while True:  # endless loop
        title = "Menu"
        selection = easygui.buttonbox(msg, title, buttons, picture)

        if selection == "Finger":
            mode = 1
            print "mode interno %d" % (mode)
            easygui.msgbox(
                "Make a L with your thumb and index finger to hold the pool stick. Circle your finger CW or CCW to rotate the pool stick.  Swipe to hit the ball. Show 5 fingers to start"
            )
            break
        elif selection == "Tool":
            mode = 2
            print "mode interno %d" % (mode)
            easygui.msgbox(
                "Hold a pen or pencil to rotate the pool stick. Move the tool fast to hit or open your hand. Show 5 fingers to start"
            )
            break

    return mode  # returns how many times the screensaver was watched (if anybody ask)
示例#13
0
文件: gui.py 项目: Tudor-B/GamepadHID
 def changefunc(self):
 
     image   = "Gamepad.gif"
     msg     = "Button Config?"
     choices = ["cross", "circle", "square", "triangle"]
     choiceBot   = eg.buttonbox(msg,image=image,choices=choices)
     
     image   = "Gamepad.gif"
     msg     = "Function Change"
     choices = ["Alt","Tab","Esc","Left mouse","Right mouse" , "Middle mouse"]
     choiceAct   = eg.buttonbox(msg,image=image,choices=choices)
     
     print ("You have now changed the button to:", choiceBot)
     print ("You have specified that function to be:", choiceAct)
     
     return choiceBot, choiceAct
示例#14
0
    def deductRocks(self, entry):
        # Remove the collectible
        entry.getIntoNodePath().getParent().removeNode()
        # Update the number of objects
        if self.score > 500:
            randomnum = random.randint(1,2)
            if randomnum == 1:
             self.score = self.score - 100 #Removes Score
            if randomnum == 2:
             self.score = self.score + 100 #Removes Score

        if self.score < 500:
            self.score = self.score - 100

        randomnum = random.randint(1,2)

        if randomnum == 1:
            result =buttonbox(msg='A kind wizard wishes to help you on your quest? Trust him?', title='Alert!', choices=("Yes", "No"))

            if result == "Yes":
                othernum = random.randint(1,100)
                othernum = othernum * self.score + self.numObjects #Y = MX + B

                if othernum > 1000:
                    msgbox("Good choice! Add 1,000 Points to your Score!")
                    self.score = self.score + 1000
                if othernum < 1000:
                    msgbox("The wizard tricked you!He stole 100 Points!")
                    self.score = self.score - 100

        printNumObj(self.score)
def main():
    with open('users_data.json', 'r') as f:
         users_data = json.load(f)
    usernames = users_data.keys()

    for username in usernames:
        current_user_data = users_data[username]
        image_number = 0
        while True:
            image = "profiles/" + username + "/" + str(image_number) + ".webp"
            if not os.path.isfile(image):
                break
            msg   = "Should this person be sent messages?"
            choices = ["Previous image","Next image","Yes","No"]
            reply=buttonbox(msg,image=image,choices=choices)
            if reply == "Yes":
                current_user_data['should_be_messaged'] = True
                break
            elif reply == "No":
                current_user_data['should_be_messaged'] = False
                break
            elif reply == "Previous image":
                image_number = max(image_number - 1, 0)
                continue
            elif reply == "Next image":
                image_number = min(image_number + 1, 2)
                continue
示例#16
0
def friends_req_sent(userData, friendshipData):
    people = friendshipData.get_friendship_reqests(userData.Username)
    msg ="Hello " + userData.Name +" \n" + msg_maker(people)
    title = "Friend req sent list"
    choices = ["Back"]
    user_resp = easygui.buttonbox(msg, title, choices)
    return user_resp
示例#17
0
    def render_main(self):
        msg = "Greetings human.\nYou can configure my settings in 'Configure' menu.\nPress 'Connect' button for " \
              "connecting to the Raspberry Pi.\nMake sure you have configured the right IP address and port."
        title = "T.A.R.S main terminal"
        buttons = [DISCONNECT, DEPLOY, SETTINGS, EXIT]
        current_state = self.state.state()
        if current_state == ALPHA:
            buttons = [CONNECT, SETTINGS, EXIT]
        elif current_state == BETA:
            msg = "TARS did not respond and connection request timed out. " \
                  "Ensure he is on network and try connecting again."
            buttons = [RETRY, SETTINGS, EXIT]
        elif current_state == GAMMA:
            msg = "There was an error while communicating with TARS."
            buttons = [RETRY, SETTINGS, EXIT]
        elif current_state == DELTA:
            msg = "Disconnected from TARS."
            buttons = [RECONNECT, SETTINGS, EXIT]
        elif current_state == EPSILON:
            msg = "Great! Now press 'Deploy' to run the search algorithm."
        elif current_state == ZETA:
            msg = "The destination is blocked on all four sides."
        elif current_state == ETA:
            msg = "Uh oh.I traversed all reachable nodes but the destination seems to be out of coverage."
        elif current_state == THETA:
            msg = "Algorithm was manually stopped. How will you like to proceed?"
        elif current_state == IOTA:
            msg = "Eureka! destination reached. "

        for notification in self.notifications:
            msg += "\n_____________________"
            msg += "\nAlert! : " + notification
        selection = easygui.buttonbox(msg, title, buttons)
        return selection
示例#18
0
 def on_exit_mouseClick(self, event):
     really = easygui.buttonbox("Do you really want to exit?",
                                choices = ("No","Yes"))
     if really == "No":
         pass
     if really == "Yes":
         sys.exit()
示例#19
0
    def downchoiceFunc():
        if "torch" in fyrirUtan.items:
            knifedoorhole = eg.buttonbox("You see a Knife, a door and a hole in the ground.", choices=DownChoice, title=fyrirUtan.info)
            if  knifedoorhole == "Pick up knife":
                eg.msgbox("You put the knife into your pocket", title=fyrirUtan.info)
                fyrirUtan.items.append("knife")
                del DownChoice[0]
                downchoiceFunc()
            elif knifedoorhole == "Open door":
                Basement.BDoor(22)
            elif knifedoorhole == "Go towards the hole":
                eg.msgbox("You walk to the hole and look down it.", title=fyrirUtan.info)
                time.sleep(0.5)
                eg.msgbox("You see light at the bottom. Looks safe enough to jump.", title=fyrirUtan.info)
                if  eg.ynbox("Jump in the hole?", title=fyrirUtan.info) == 1:
                    Basement.fall()
                else:
                    eg.msgbox("You decide not to jump", title=fyrirUtan.info)
                    downchoiceFunc()
            elif knifedoorhole == "Go back":
                eg.msgbox("You whent back up.", title=fyrirUtan.info)
                mainRoom()
 
            else:
                eg.msgbox("It sure is dar...", title=fyrirUtan.info)
                eg.msgbox("SHIT!", title=fyrirUtan.info)
                eg.msgbox("You fell into a hole.", title=fyrirUtan.info)
                time.sleep(0.75)
                Basement.fall()
示例#20
0
 def counter_Attack():
     global Damage
     global Enemy_damage
     counter_attack_Direction = randint(1,3)
     CA_Direction = ("Attack Left!", "Attack Middle!", "Attack Right!")
     if counter_attack_Direction == 1:
         vulnerable = "Left"
     elif counter_attack_Direction == 2:
         vulnerable = "Middle"
     else:
         vulnerable = "Right"
     start_time = time.time()
     Counter_Attack = eg.buttonbox("The monster is vulnerable to attack from the "+ vulnerable +"!", choices=CA_Direction, title=fyrirUtan.info)
     total_time =time.time() - start_time
     print (total_time)
     print (vulnerable)
     print (Counter_Attack)
     if Counter_Attack == "Attack Left!" and vulnerable == "Left":
         Enemy_Hit()
     elif Counter_Attack == "Attack Middle!" and vulnerable == "Middle":
         Enemy_Hit()
     elif Counter_Attack == "Attack Right!" and vulnerable == "Right":
         Enemy_Hit()
          
     else:
         eg.msgbox("You missed and the monster regained his strength!", title=fyrirUtan.info)
def show_windows():
    while 1:
#            title = "Message from test1.py"
#            eg.msgbox("Hello, world!", title)
    
        msg ="Run with which classification model?"
        title = "Classification model"
        models = ["Multinomial Naive Bayes", "Support Vector Machines", "Maximum Entropy"]
        model_choice = str(eg.choicebox(msg, title, models))
    
        msg     = "Use saved preset values?"
        choices = ["Yes","No"]
        choice = eg.buttonbox(msg,choices=choices)
        if str(choice)=="Yes":
            model_preset_functions[model_choice]()
        else:
            model_select_functions[model_choice]()
    
        # note that we convert choice to string, in case
        # the user cancelled the choice, and we got None.
#            eg.msgbox("You chose: " + str(choice), "Survey Result")
        message = "Sentiments over time period something something"
        image = "temporal_sentiments.png"
        eg.msgbox(message, image=image)
        
        msg = "Do you want to continue?"
        title = "Please Confirm"
        if eg.ccbox(msg, title):     # show a Continue/Cancel dialog
            pass  # user chose Continue
        else:
            sys.exit(0)           # user chose Cancel
示例#22
0
    def do_after_download(self):
        """
        Do something after downloading finished.
        """
        # check the files
        for f in self.downloaded_file_list:
            if not self.check_b2g_image(os.path.abspath(f)):
                logger.debug('{} is not b2g image.'.format(f))
                if not self.check_gaia_package(os.path.abspath(f)):
                    logger.debug('{} is not gaia package.'.format(f))
                    if not self.check_gecko_package(os.path.abspath(f)):
                        logger.debug('{} is not gecko package.'.format(f))

        if (not self.has_image) and (not self.has_gaia) and (not self.has_gecko):
            # there is no any package found
            easygui.msgbox('Cannot found B2G Image, Gaia, and Gecko.', ok_button='I know')
        else:
            title = 'Flash B2G'
            msg = self.generate_flash_message()
            choices = self.generate_flash_choices()
            reply = easygui.buttonbox(msg, title, choices=choices)
            logger.info('Select: {}'.format(reply))
            # then call method by reply's string
            if reply:
                call_method = getattr(self, 'flash_' + reply)
                call_method()
        super(B2GTraverseRunner, self).do_after_download()
示例#23
0
文件: PEX0.py 项目: Jaren831/usafa
def main():
    """
    Begins the program. Prompts user for image file and then passes this to get_exif function. Only file no directory.
    :return:
    """
    start = easygui.buttonbox(msg="Picture or Folder?", title="Welcome to Where's My Ex! Choose a Picture",
                              choices=["Upload Picture", "Cancel"])
    # if start == "Upload Directory":
    #     file_search = easygui.diropenbox()
    #     directory_list = os.listdir(file_search)
    #     for file in directory_list:
    #         if imghdr.what(file) == "gif" or "jpeg":
    #             get_exif(file)
    #         else:
    #             print("No image detected")
    #             sys.exit()
    if start == "Upload Picture":
        file = easygui.fileopenbox(default="./data/")
        if imghdr.what(file) == 'gif' or 'jpeg':
            get_exif(file)
        else:
            print("No image detected")
            sys.exit()
    elif start == "Cancel":
        sys.exit(0)  # Exit Program
示例#24
0
文件: __init__.py 项目: Uberi/autom
def dialog_prompt(message = "Press any button to continue", title = "Message Box", buttons = ["OK"]):
    """
    Show a dialog with prompt `message`, title `title`, and a set of buttons `buttons` to choose from.
    
    Returns the text of the button chosen, or `None` if closed.
    """
    return easygui.buttonbox(str(message), str(title), str(buttons))
示例#25
0
	def popup(self, device):
		choices = ["Exit", "Others(Info/Config)"]
		reply = easygui.buttonbox(device.get_info(), title = device.get_name(), choices = choices)
		
		# Select between all types of components to see which window to draw
		if cmp(reply, 'Others(Info/Config)') == 0:
			if cmp(device.get_name(), 'EthernetRJ45') == 0:
				subprocess.call("./scripts/rj45.sh > buff", shell=True);
				f = open("buff","r");
				reply = easygui.msgbox(f.read(), title = "Ethernet Info")
				f.close()
			elif cmp(device.get_name(), 'CPUGPU') == 0:
				choices = ["CPU","GPU","SystemLoad","Presentation"]
				reply = easygui.buttonbox("Choose..", choices=choices)
				if cmp(reply, 'CPU') == 0:
					subprocess.call("./scripts/cpu.sh > buff", shell=True);
					f = open("buff","r");
					reply = easygui.msgbox(f.read(), title = "CPU Info")
					f.close()
				elif cmp(reply, 'GPU') == 0:
					subprocess.call("./scripts/gpu.sh > buff", shell=True);
					f = open("buff","r");
					reply = easygui.msgbox(f.read(), title = "GPU Info")
					f.close()
				elif cmp(reply, "SystemLoad") == 0:
					subprocess.call("./scripts/sysload.sh > buff", shell=True);
					f = open("buff","r");
					reply = easygui.msgbox(f.read(), title = "System Load Info")
					f.close()
				else:
					subprocess.call("./scripts/processing_unit.sh", shell=True);
			elif cmp(device.get_name(), 'USB') == 0:
				subprocess.call("./scripts/usb.sh > buff", shell=True);
				f = open("buff","r");
				reply = easygui.msgbox(f.read(), title = "USB Info")
				f.close()
			elif cmp(device.get_name(), 'USBPower') == 0:
				reply = easygui.msgbox("Power is On", title = "Power Info")
			elif cmp(device.get_name(), 'EthernetController') == 0:
				choices = ["Connect through SSH", "Presentation"]
				reply = easygui.buttonbox("Connection", choices=choices)
				if cmp(reply, 'Connect through SSH') == 0:
					self.ethcontr()
				else:
					subprocess.call("./scripts/memory.sh", shell=True);
			else:
				reply = easygui.msgbox("No other info(Sorry:))", title = device.get_name(), ok_button = "Exit")
示例#26
0
 def add_edit(op='Add', update_what=None):
         config_file = shelve.open(os.environ['APPDATA']+r'\FeedAbyte\YoDa\config', writeback=True)
         if op == 'Add':
                 tup = 'new'
         else:
                 tup = ''
         if op == 'Add':
                 name = easygui.enterbox(title='YoDa by Yogi', msg='Please enter a name for the Download Manager, Leave blank if you want me to choose one :)')
         path = easygui.fileopenbox(title='YoDa by Yogi', msg='Please select the %s path for Download Manager' % tup, filetypes=['*.exe'],
                                    default=(os.environ['PROGRAMFILES']+'\\'))
         if not os.path.isfile(path):
                 easygui.msgbox(title='YoDa by Yogi', msg='Path cannot be blank. Please try again providing valid path')
                 exit(0)
         command = easygui.enterbox(title='YoDa by Yogi',msg='Please enter the %s YoDa syntax of command(Ref. ReadMe) for the given Download Manager'%tup)
         if not command:
                 easygui.msgbox(title='YoDa by Yogi', msg='Command can not be blank. Please try adding again with proper command')
                 exit(0)
         if path and command:
                 if not path.endswith('.exe'):
                         choice_box = ['No it\'s alright', 'Oops! I\'m mistaken']
                         now_what = easygui.buttonbox(title='YoDa by Yogi', msg='You are on Windows. Ain\'t you? Shouldn\'t it be .exe file?',
                                                      choices=choice_box)
                         if now_what == choice_box[1]:
                                 easygui.msgbox(title='YoDa by Yogi', msg='It\'s ok. Let\'s try again.')
                                 exit(0)
         if op == 'Add':
                 if not name:
                         name = os.path.basename(path).split('.')[0]
                 for i in config_file['path_config']:
                     if name == i:
                             bba = easygui.buttonbox(title='YoDa by Yogi',
                                                     msg='A download manager with the name already exists(Ref ReadMe(Add.1))',
                                                     choices=['Overwrite', 'Try with different name'])
                             if bba == 'Try with different name':
                                     name = easygui.enterbox(title='YoDa by Yogi',msg='Enter new name for the download manager')
                 if not name:
                         name = path.split('.')[0]
                 config_file['path_config'][name] = {'path': path, 'cmd': command}
                 config_file.sync()
                 config_file.close()
                 easygui.msgbox(title='YoDa by Yogi',msg='Values has been updated successfully')
         if op == 'Edit':
                 config_file['path_config'][update_what] = {'path': path, 'cmd': command}
                 config_file.sync()
                 config_file.close()
                 easygui.msgbox(title='YoDa by Yogi',msg='Values has been updated successfully')
	def analyze(self,igroup):
		# to get the sourcedata
		resultdatagrouped=self.gettmpdata('resultdatagrouped');
		
		spectra=resultdatagrouped[0]['datagroups'][igroup];
		spectranew=spectra.getemptyinstance();
		
		fig=XpyFigure();
#======================================================================
#         the real calculation
#======================================================================
		Tgroups=spectra.group(["Temperature"]);
		
		canceled=False;
		satisfied=False;
		pylab.hold(False);
		while not satisfied and not canceled:
			keys=Tgroups[0].keyssorted(["min(x)"]);
			j=0;
			for Tspectra in Tgroups:
				spect0=Tspectra[keys[0]];
				for i in range(1,len(keys)):
			#=======================================display:
					spect=Tspectra[keys[i]];
					spect0.plot('b');
					pylab.hold(True);pylab.grid(True);
					spect.plot('r');
					answer=easygui.boolbox("Choose the range for for merging","Individual merging",["OK","Cancel"]);
					if answer==1:
						A=pylab.axis();
						xmin=A[0];
						xmax=A[1];
				for Tspectra in Tgroups:
					spect0=Tspectra[keys[0]].copyxy();
					for i in range(1,len(keys)):
						spect=Tspectra[keys[i]];
						spect0.indmerge(spect,xmin,xmax);
						spect0.log({"Operation":"indmerge","xmin":xmin,"xmax":xmax});
					spectnew=spect0;
					
				spect0.plot('g');
			else:	
				canceled=True;
			if not canceled:
				answer=easygui.buttonbox("Satisfied?","Individual merging",["Yes","No","Cancel"]);
					#print "answer:",answer
				if answer=="Yes":
					satisfied=True;
				elif answer=="Cancel":
					canceled=True;
			if canceled:
				break;
					
		spectnew=spect0;	
		spectranew.insert(spectnew,keys[0]);
		spectra=resultdatagrouped[0]['datagroups'][igroup]=spectranew;
		#pylab.figure();
		spectranew.plot('o');
示例#28
0
def mainRoom():
    updownmiddle = ["Down","Front","Up"]
    way = eg.buttonbox("You see 3 doors. One leading UP, one leading DOWN to the basement and one to the FRONT", choices=updownmiddle, title=fyrirUtan.info)
    if way == "Down":
        Down()
    if way == "Front":
        Middle()
    if way == "Up":
        Up()
示例#29
0
 def _choose_option(self, msg, choices):
     """
     Easygui implementation of showing options and letting the user choose one of them.
     """
     reply = easygui.buttonbox(msg, choices=choices)
     if reply is "Yes":
         return YES
     elif reply is "No":
         return NO
示例#30
0
    def on_neuesDict_mouseClick(self, event):
        import dict

        if (
            easygui.buttonbox(
                "Dies wird alle im moment Verschlüsselten dateinen unbrauchbar machen!\nSicher?", "", ("Ja", "Nein")
            )
            == "Ja"
        ):
            dict.create()
示例#31
0
def open_box():
    read_sum_money_now()  #方便显示当前余额
    if float(sum_money_now) > 0:
        yourchoice = g.buttonbox(
            msg='大佬您想开什么宝箱呢?开宝箱可是要花费金币的噢,O(∩_∩)O ,您当前余额为' +
            str(round(sum_money_now, 1)) + '个金币!',
            choices=('初级宝箱:消耗10~20金币', '中级宝箱:消耗20~50金币', '高级宝箱:消耗50~100金币'))
        if yourchoice == '初级宝箱:消耗10~20金币':
            small_box()
            f = open('small_box_contains.md', 'a+')
            f = open('small_box_contains.md', 'r')
            small_box_contains = f.read()
            f.close()
            g.msgbox('初级宝箱里面的奖励现在有\n\n{' + small_box_contains + '}',
                     ok_button="好的,朕已阅")
            choujiang_small_box_contains()
            g.msgbox('您这次消费了:' + str(round(reward, 1)) + '个金币,大佬,您目前的余额还有' +
                     str(round(sum_money_now, 1)) + '个金币',
                     ok_button="好的,朕已阅")
        elif yourchoice == '中级宝箱:消耗20~50金币':
            middle_box()
            f = open('middle_box_contains.md', 'a+')
            f = open('middle_box_contains.md', 'r')
            middle_box_contains = f.read()
            f.close()
            g.msgbox('中级宝箱里面的奖励现在有\n\n{' + middle_box_contains + '}',
                     ok_button="好的,朕已阅")
            choujiang_middle_box_contains()
            g.msgbox('您这次消费了:' + str(round(reward, 1)) + '个金币,大佬,您目前的余额还有' +
                     str(round(sum_money_now, 1)) + '个金币',
                     ok_button="好的,朕已阅")
        elif yourchoice == '高级宝箱:消耗50~100金币':
            super_box()
            f = open('super_box_contains.md', 'a+')
            f = open('super_box_contains.md', 'r')
            super_box_contains = f.read()
            f.close()
            g.msgbox('初级宝箱里面的奖励现在有\n\n{' + super_box_contains + '}',
                     ok_button="好的,朕已阅")
            choujiang_super_box_contains()
            g.msgbox('您这次消费了:' + str(round(reward, 1)) + '个金币,大佬,您目前的余额还有' +
                     str(round(sum_money_now, 1)) + '个金币',
                     ok_button="好的,朕已阅")
        else:
            pass
    else:
        g.msgbox('您当前余额为' + str(round(sum_money_now, 1)) +
                 ',无法再开宝箱,该去做任务攒金币了!',
                 ok_button="好的,朕已阅")
        pass
示例#32
0
def C_and_F():
    yes = 'y'
    while (1):
        easygui.msgbox("您好,这里是温度转换器。(只限摄氏度和华氏度)")
        a = easygui.buttonbox("请选择您要转换的温度种类(开始时的单位):", choices=['摄氏度', '华氏度'])
        if a == '摄氏度':
            s = easygui.enterbox("输入数值:")
            z = 1.8 * float(s) + 32
            easygui.msgbox(str(s) + "摄氏度等于" + str(z) + "华氏度")
            restart = True
        elif a == '华氏度':
            o = easygui.enterbox("输入数值:")
            x = ((float(o) - 32) / 1.8)
            easygui.msgbox(str(o) + "华氏度等于" + str(x) + "摄氏度")
            restart = True
        else:
            easygui.msgbox("输入错误,请重新输入!")
            restart = False

        if restart == True:
            start = easygui.buttonbox("是否还需要换算?", choices=['是', '否'])
            if start == '否':
                break
示例#33
0
def main():
    if os.path.isfile('metadata.pkl'):
        with open('metadata.pkl', 'rb') as meta:
            data = pickle.load(meta)
    else:
        data = {
            'LastComicPage': 0,
            'FavoriteComics': set(),
            'SharedComics': set(),
            'ComicLimit': 1863,
        }
    count = data['LastComicPage'] + 1
    while True:
        image = get_image(count)
        if not image:
            data['ComicLimit'] = count
            data['LastComicPage']
            msg = 'No More Comics at the moment.\n'
            msg += 'Do you want to start from first comic.'
            title = 'Sorry'
            options = ['Yes', 'No', 'Close']
            select = gui.buttonbox(msg=msg,
                                   title=title,
                                   choices=options,
                                   cancel_choice='Close')
            if select == 'Close':
                quit()
            elif select == 'Yes':
                data['LastComicPage'] = count = 1
                image = get_image(count)
            elif select == 'No':
                msg = 'Nothing else i can do.'
                title = 'Sorry'
                gui.msgbox(msg=msg, title=title)
                quit()

        opt = show_image(image)
        count += 1
        if opt == 'Close':
            break

        elif opt == 'Favorite':
            save_image(image, data)

        elif opt == 'Next':
            continue

    data['LastComicPage'] = count - 1
    with open('metadata.pkl', 'wb') as meta:
        pickle.dump(data, meta)
示例#34
0
def show_student_message(student):
    message = [
        student.学号.string, student.姓名.string, student.性别.string,
        student.年龄.string, student.院系.string, student.入学时间.string
    ]
    strs = ''
    strs += '学号' + message[0]
    strs += '\n姓名' + message[1]
    strs += '\n性别' + message[2]
    strs += '\n年龄' + message[3]
    strs += '\n院系' + message[4]
    strs += '\n入学时间' + message[5] + '\n'
    flag = t.buttonbox(strs, '查找到的学生信息', ('修改学生信息', '删除', '继续'))
    return flag
示例#35
0
def get_csv_paths(args) -> (str, str):
    """
    If args.use_gui is true, shows a gui allowing
    the user to set the paths for the families and rows csv files.
    Otherwise uses args.rows_path and args.families_path.
    Returns a tuple with (families_path, rows_path).
    """
    if args.use_gui:
        rows_csv_path = None
        families_csv_path = None
        ready = False
        while not ready:
            choice = easygui.buttonbox(
                msg='Please choose a csv file with a seating layout and a csv '
                'file with family information.'
                '\nThe seating layout csv has two columns: name and length'
                '\nThe families csv has two columns: name and size'
                '\n\n\nCurrent selections\n'
                f'Seating layout: {rows_csv_path}\n'
                f'Families: {families_csv_path}\n',
                title='Setup hall and families',
                choices=[
                    SELECT_ROW_CSV_CHOICE, SELECT_FAM_CSV_CHOICE, READY_CHOICE
                ])
            if choice is None:
                sys.exit()
            if choice == SELECT_FAM_CSV_CHOICE:
                families_csv_path = easygui.fileopenbox(
                    title='Family csv file',
                    filetypes=['*.csv'],  # FIXME: doesn't work
                )
            if choice == SELECT_ROW_CSV_CHOICE:
                rows_csv_path = easygui.fileopenbox(
                    title='Seating layout csv file',
                    filetypes=['*.csv'],  # FIXME: doesn't work
                )
            if choice == READY_CHOICE:
                if families_csv_path is None or rows_csv_path is None:
                    easygui.msgbox(
                        msg='Please select both a family information csv '
                        'and a seating layout csv.',
                        title='Not all csv files selected')
                else:
                    ready = True

    else:
        families_csv_path = args.families_path
        rows_csv_path = args.rows_path

    return families_csv_path, rows_csv_path
def popUpImage(img):
    #image = "/home/pranjal/Documents/PythonProjects/PyTorch-YOLOv3/data/samples/dog.jpg"
    image = img
    msg = "Do you want to enter bibId?"
    choices = ["Yes", "No"]
    boolean = False
    fieldValues = []  # we start with blanks for the values
    while (not boolean):
        reply = buttonbox(msg, image=image, choices=choices)
        print(reply)

        if reply == "Yes":
            msg = "Enter BibId"
            title = "Runner bibId"
            fieldNames = ["BibId"]
            boolean = True

            fieldValues = multenterbox(msg, title, fieldNames)
            if fieldValues == None:
                print('Entered value', 0)
            else:
                print('Entered value', fieldValues[0])

            # make sure that none of the fields was left blank
            while 1:
                if fieldValues == None:
                    fieldValues = []
                    fieldValues.append(0)
                    boolean = False
                    break
                errmsg = ""
                for i in range(len(fieldNames)):
                    if fieldValues[i].strip() == "":
                        errmsg = errmsg + ('"%s" is a required field.\n\n' %
                                           fieldNames[i])
                if errmsg == "": break  # no problems found
                fieldValues = multenterbox(errmsg, title, fieldNames,
                                           fieldValues)
                #print('Entered value',fieldValues)
                # if(fieldValues is None):
                #     boolean=False
                # else:
                boolean = True
                print("Entered BibId:", fieldValues[0])

        else:
            fieldValues.append(0)
            print("Entered BibId:", fieldValues[0])
            boolean = True
    return fieldValues[0]
示例#37
0
 def act(self):
     torch = self.sensing_token(distance=0, token_type=Torch)
     if torch:
         message = "Du findest eine Fackel. Möchtest du sie aufheben?"
         choices = ["Ja", "Nein"]
         reply = easygui.buttonbox(message, "RPG", choices)
         if reply == "Ja":
             self.inventory.append("Torch")
             self.board.torch.remove()
             self.board.console.newline("Du hebst die Fackel auf.")
         self.board.toolbar.add_widget(
             ToolbarButton("Fackel", "rpgimages/torch.png"))
     # look forward
     actors_in_front = self.sensing_tokens(distance=1, token_type=Door)
     if self.board.door:
         if self.board.door in actors_in_front:
             if self.board.door.closed:
                 message = "Die Tür ist geschlossen... möchtest du sie öffnen"
                 choices = ["Ja", "Nein"]
                 reply = easygui.buttonbox(message, "RPG", choices)
                 if reply == "Ja":
                     self.board.door.open()
                     self.board.console.newline("Du hast das Tor geöffnet.")
示例#38
0
def chaxun(user):
    while True:
        retval = g.buttonbox(msg=("尊敬的%s您好,欢迎使用查询功能,请选择您的查询类别"%user),
                             title="查询",
                             choices=("订单信息", "账户信息", "搜索"))
        if retval == "订单信息":
            dingdan(user)
        elif retval == "账户信息":
            zhanghu(user)
        elif retval == "搜索":
            sousuo(user)
        else:
            break
    return
def startup():
    if easyGUI == True:
        x = easygui.buttonbox(msg='Please select whether you want to be' +
                              ' quized in either Spanish or English',
                              title=title,
                              choices=('Spanish', 'English'))
        if x == 'Spanish':
            return 'spanish'
        elif x == 'English':
            return 'english'
    else:
        var = tk.Startup()
        if var.close != True:
            return var.answer
示例#40
0
def main(user):
    while True:
        retval = g.buttonbox(msg=("尊敬的%s您好,欢迎使用共享单车,请选择您的操作"%user),
                             title="用户程序",
                             choices=("租车", "充值", "查询"))
        if retval == "租车":
            zuche(user)
        elif retval == "充值":
            chongzhi(user)
        elif retval == "查询":
            chaxun(user)
        else:
            break
    return
def help(kérd, a, b, c, d, hely, hpd):
    if (len(hpd)) == 4:
        selectmenu = easygui.buttonbox("Legyen Ön is milliomos",
                                       image="2-jtk.png",
                                       title=hpd[0],
                                       choices=[hpd[1], hpd[2], hpd[3]])
    elif (len(hpd)) == 3:
        selectmenu = easygui.buttonbox("Legyen Ön is milliomos",
                                       image="2-jtk.png",
                                       title=hpd[0],
                                       choices=[hpd[1], hpd[2]])
    elif (len(hpd)) == 2:
        selectmenu = easygui.buttonbox("Legyen Ön is milliomos",
                                       image="2-jtk.png",
                                       title=hpd[0],
                                       choices=[hpd[1]])
    elif (len(hpd)) == 1:
        return "Ön már elhasználta a segítségeit"

    while True:
        if selectmenu == "Telefonos: 1-es gomb":
            phone = helpoptions.phone(hely)
            xx = hpd.index("Telefonos: 1-es gomb")
            del hpd[xx]
            return phone

        elif selectmenu == "Felezés: 2-es gomb":
            twooption = helpoptions.half(hely)
            xx = hpd.index("Felezés: 2-es gomb")
            del hpd[xx]
            return twooption

        elif selectmenu == "Közönség: 3-as gomb":
            spectrs = helpoptions.spectators(hely)
            xx = hpd.index("Közönség: 3-as gomb")
            del hpd[xx]
            return spectrs
示例#42
0
    def run(self):
        try:
            self._find_headers()
        except NoDataFoundError:
            easygui.msgbox(
                "Could not find any data!\n\nThe program will now close.")
            exit()

        self._decode_points()

        choices = ["Continue", "Change Output\nLocation", "Cancel"]
        resp = True
        while resp not in (choices[0], choices[2], None):
            msg = "Found headers:"
            msg += "\n" + ("¯" * len(msg))
            for h in self._header_names:
                msg += "\n" + h

            msg += """

Customer Enquiry Reference:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
{}

{} point loaded.
{} errors.

Output Location:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
{}""".format(self._customer_enq_ref, self._creator.get_num_points(),
             len(self._errors), self._creator.get_output_path())
            resp = easygui.buttonbox(msg, __title__, choices)

            if resp == choices[0]:
                self._creator.output()

            elif resp == choices[1]:
                new_path = easygui.filesavebox(
                    default=self._creator.get_output_path(),
                    filetypes=["*.kml"])
                if new_path is None:
                    pass
                else:
                    self._creator.set_output_path(new_path)
            else:
                exit()

            subprocess.Popen(r'explorer /select,"{}"'.format(
                self._creator.get_output_path()))
示例#43
0
def rotateimage(fname):
    image = (fname)
    msg = "How do I edit this image?"
    choices = ["Rotate","Flip","Greyscale","Logo","Cancel"]
    reply = easygui.buttonbox(msg, image=image, choices=choices)
    if reply == "Cancel":
        start()

    if reply == "Rotate":
        image = Image.open(fname)
        rotatedimage = image.rotate(90, expand=True)
        rotatedimage.save(fname)
        rotateimage(fname)

    if reply == "Flip":
        image = Image.open(fname)
        flippedimage = image.transpose(Image.FLIP_LEFT_RIGHT)
        flippedimage.save(fname)
        rotateimage(fname)

    if reply == "Greyscale":
        image = Image.open(fname)
        greyimage = image.convert('L')
        greyimage.save(fname)
        rotateimage(fname)

    if reply == "Logo":
        image = Image.open(fname)
        if len(sys.argv) == 1:
            event, values = sg.Window('Rotator',
                            [[sg.Text('Logo to open')],
                            [sg.In(), sg.FileBrowse()],
                            [sg.Open(), sg.Cancel()]]).read(close=True)
            fname2 = values[0]
        else:
            fname2 = sys.argv[1]

        if not fname2:
            sg.popup("Ok", "No filename supplied")
            rotateimage(fname)


        else:
            logo = Image.open(fname2)
            image_copy = image.copy()
            position = ((image_copy.width - logo.width), (image_copy.height - logo.height))
            image_copy.paste(logo, position)
            image_copy.save(fname)
            rotateimage(fname)
示例#44
0
    def explore(self):
        formatted_fields = ""
        for f in self.get_fields():
            formatted_fields += "- " + f + "\n"
        formatted_fields = formatted_fields.strip()
        choices = [
            "View Points", "View Errors", "Change Export\nLocation",
            "Change Icon\nSource Directory"
            "Back"
        ]
        while True:
            text = """Input File:
{}
Output File:
{}

Points: {}
Errors: {}
Fields:
{}""".format(self._input_path, self._output_path, len(self._points),
             len(self._errors), formatted_fields)
            choice = easygui.buttonbox(text, "Data Explorer", choices)
            if choice == choices[0]:
                point_choices = [p.one_line() for p in self._points]
                point_choice = easygui.choicebox("Choose a point to view:",
                                                 "Points", point_choices)
                if point_choice is not None:
                    self._points[point_choices.index(point_choice)].easy_view()
                else:
                    pass
            elif choice == choices[1]:
                error_explorer(self._errors)
            elif choice == choices[2]:
                new_path = easygui.filesavebox("Choose Save Location",
                                               default=self._output_path,
                                               filetypes=["*.csv"])
                if new_path is None:
                    pass
                else:
                    self._output_path = new_path
            elif choice == choice[3]:
                new_path = easygui.diropenbox("Choose Icon Location",
                                              default=self._icon_dir)
                if new_path is None:
                    pass
                else:
                    self._icon_dir = new_path
            else:
                raise UserCancelError()
示例#45
0
def PlayAgain(characterlocation, enemylocation, lives, questions):
    """Allows user to play again"""

    choice = easygui.buttonbox(
        msg="Would you like to play again?", choices=["YES", "NO"])
    # Displays an easygui button box that asks the player if they want to play again

    if choice == "NO":
        sys.exit()
    # If the player chose to not play again, the program ends

    characterlocation, enemylocation, lives, questions = PresetVariables()
    # Calls the function that resets the variables, if the user chooses to play again

    return characterlocation, enemylocation, lives, questions
def second_try():
    choice = easygui.buttonbox(
        'Co chcesz zrobić ?', 'Your BMI status',
        ['Sprawdz BMI', 'BMI w Polsce', 'Zamknij program'])
    if choice == 'Sprawdz BMI':
        weight = int(easygui.enterbox('Podaj wagę: '))
        height = cm_to_m(
            float(easygui.enterbox('Podaj wzrost w centymentrach: ')))
        check_bmi(weight, height)
    if choice == 'BMI w Polsce':
        print(show_image())
        second_try()
    if choice == 'Zamknij program':
        easygui.msgbox('3maj forme, life if life ', 'Exit window')
        time.sleep(3)
示例#47
0
def model_choice():  #定义一个函数
    global model  #声明一个全局变量
    model = gui.buttonbox(msg="""——————模式大全——————
[1]简单(范围1-5随机整数)
[2]普通(范围1-10随机整数)
[3]魔鬼模式(范围1-5随机实数。可以尝试50次!)
[4]自定义模式(随机数范围自定义。尝试次数自定义)
[0]开发中...
——————模式大全——————
请选择您的模式!
""",
                          title="猜数字小游戏",
                          choices=("简单", "普通", "魔鬼", "自定义"))  #用户返回一个模式(字符串)
    global model_continue  #声明一个全局函数
    model_continue = "不了不了"  #将变量赋值
示例#48
0
    def vecinosGP(self, event):
        vecino = str(self.ip_vecino.GetLineText(0))
        local = str(self.numero_as_local.GetLineText(0))
        remoto = str(self.numero_as_remoto.GetLineText(0))

        flag = funcionesTelnet.validarFormatoIP(vecino)
        if (flag and local != "" and remoto != ""):
            funcionesTelnet.configurarVecino(vecino, local, remoto, tn)
            print("se guardo correntamente")
            msg = "SE GUARDO CORRECTAMENTE"
            titulo = "MENSAJE:"
            choices = ["OK"]
            reply = eg.buttonbox(msg, title=titulo, choices=choices)
        else:
            if (local == "" and remoto == ""):
                msg = "ERROR: No se ha ingresado AS previamente"
                titulo = "error"
                choices = ["ok"]
                reply = eg.buttonbox(msg, title=titulo, choices=choices)
            else:
                msg = "error ingrese una direccion ip"
                titulo = "error"
                choices = ["ok"]
                reply = eg.buttonbox(msg, title=titulo, choices=choices)
示例#49
0
    def verify_redaction(self):
        """Verify the final list of entities to be redacted and allow user to either edit the redaction or output the file."""

        verify_choice = g.buttonbox(
            "To verify your redaction choices and exit, click Verify. \n To remove or edit your choices, click Edit.",
            "Check or Edit Redaction Choices.",
            choices=["Verify", "Edit"],
        )
        if verify_choice == "Verify":
            # Show all to_redact keys
            edit_choice = g.buttonbox(
                f"Redacting: {list(self.redact.keys())}",
                "Verify Redaction",
                choices=["Save and Exit", "Edit"],
            )

            if edit_choice == "Save and Exit":
                self.prep_outfile()

            elif edit_choice == "Edit":
                self.prep_outfile(edits=self.edit())

        if verify_choice == "Edit":
            self.prep_outfile(edits=self.edit())
示例#50
0
 def time_period(title):
     msg = '请问您准备何时出发?'
     a = g.buttonbox(msg, title, ['10分钟以内', '预约拼车'])
     if a == '10分钟以内':
         t1 = dt.datetime.now()
         t2 = t1 + dt.timedelta(minutes=10)
     else:
         msg2 = '请输入出发时间\n时间格式为“年-月-日-时-分”,如“2020-12-13-15-23”'
         b = g.multenterbox(msg2, title, ['最早出发时间', '最晚出发时间'])
         t1 = [int(i) for i in b[0].split('-')]
         t1 = dt.datetime(t1[0], t1[1], t1[2], t1[3], t1[4])
         t2 = [int(i) for i in b[1].split('-')]
         t2 = dt.datetime(t2[0], t2[1], t2[2], t2[3], t2[4])
     time = [t1.strftime('%Y-%m-%d %H:%M'), t2.strftime('%Y-%m-%d %H:%M')]
     return time
示例#51
0
def main():
    try:
        opt = easygui.buttonbox('What do you wish to do?', 'Tasking...',
                                ('Individual Chat', 'Host a Group Chat Server',
                                 'File Search', 'File Transfer', 'Exit'))
    except:
        opt = str(
            raw_input(
                "What do you wish to do?\nIndividual Chat\nHost a Group Chat Server\nFile Search\nFile "
                "Transfer\nExit\n\nEnter choice: "))
    if opt == 'Exit':
        return
    else:
        handle_opt(opt)
    return
def menu():
    selectmenu = easygui.buttonbox(
        "Legyen Ön is milliomos",
        image="1-kép.png",
        choices=['\n Játék indítása\n', '\n Dicsőségtábla \n', '\n Kilépés\n'])
    while True:
        if selectmenu == '\n Játék indítása\n':
            test()
            break
        elif selectmenu == '\n Dicsőségtábla \n':
            resultstablereadprint.resultlist()
            menu()
            break
        elif selectmenu == '\n Kilépés\n':
            exit()
示例#53
0
def zhi_shu_pan_duan():
    easygui.msgbox("你好,这个程序可以帮你判断一个数是否是质数。", ok_button="开始吧!")
    while (1):
        num = easygui.integerbox("请输入要判断的数", lowerbound=2, upperbound=2e10)
        is_prime = False
        for i in range(2, num):
            if num % i == 0:
                is_prime = True
        if is_prime == True:
            easygui.msgbox(str(num) + "不是质数。")
        else:
            easygui.msgbox(str(num) + "是质数。")
        start = easygui.buttonbox("是否还要使用", choices=["是", "否"])
        if start == "否":
            break
示例#54
0
文件: admin.py 项目: pkuzzy/db
def danche():
    while True:
        retval = g.buttonbox(msg="您想要对单车做什么?",
                             title="管理单车",
                             choices=("增加单车", "删除单车", "查询单车"))
        if retval == None:
            break
        if retval == "增加单车":
            fieldNames = ["ID", "type", "state", "cost", "district", "street", "longitude", "latitude"]
            fieldValues = []
            fieldValues = g.multenterbox("填写单车信息", "增加单车", fieldNames)
            if fieldValues == None:
                continue
            if net.sent("jiache " + " ".join(fieldValues)) == "ok":
                g.msgbox("增加成功", title="增加单车")
            else:
                g.msgbox("单车已经存在", title="增加单车")
        elif retval == "删除单车":
            fieldNames = ["ID"]
            fieldValues = []
            fieldValues = g.multenterbox("填写单车信息", "删除单车", fieldNames)
            if fieldValues == None:
                continue
            l = net.sent("shanche " + " ".join(fieldValues))
            if l == "ok":
                g.msgbox("删除成功", title="删除单车")
            elif l == "not_exist":
                g.msgbox("单车不存在", title="删除单车")
        elif retval == "查询单车":
            fieldNames = ["ID"]
            fieldValues = []
            fieldValues = g.multenterbox("填写单车信息", "查询单车", fieldNames)
            if fieldValues == None:
                continue
            l = net.sent("chache " + " ".join(fieldValues)).split()
            if l[0] == "ok":
                s = "单车编号: " + fieldValues[0] + "\n"
                s += "单车类型: " + l[1] + "\n"
                s += "单车状态: " + l[2] + "\n"
                s += "单车单价: " + l[3] + "\n"
                s += "单车区域: " + l[4] + "\n"
                s += "单车街道: " + l[5] + "\n"
                s += "经度: " + l[6] + "\n"
                s += "维度: " + l[7] + "\n"
                g.textbox(msg="单车信息如下:", title="单车信息", text=s)
            elif l[0] == "not_exist":
                g.msgbox("单车不存在", title="删除单车")
    return
示例#55
0
 def writeDB(self,msg):
     s = False
     while s != True or choice==None:
         choice = eg.buttonbox(msg='异常原因?', title='异常', choices=('误判', '接头', '材料跑偏'))
         s = eg.ynbox('你的选择是:' + str(choice), "确认?", ('是', '否'))
         if s == True and choice !=None:
             print("yes", s, choice)
             shift = "None"
             # 'S:,,,,2.1,1.2,1.2,2.1,,,,,,,,,,,,,2019-11-12 13:33,A:E'
             # '1,,,,5,6,7,8,,,,,,,,,,,,,2019-11-12 13:33,A:E'
             message = "S:,,,," + msg + "," + str(window.dist) + "," + str(
                 window.wid) + "," + choice + "," + ",,,,,,,,,,,," + str(timeit.default_timer())\
             + "," + shift + ":E"
             db.writeDB(message)
         else:
             pass
示例#56
0
def day0ise():
    osalemine = easygui.buttonbox("Kas tahad infotunnis osaleda?",
                                  "Infotund",
                                  image="pildid/vanemuine46.png",
                                  choices=["Jah", "Ei"])
    if osalemine == "Jah":
        kirjutamine = easygui.ynbox("Kas soovid märkmeid teha?", "Märkmed",
                                    ["Jah", "Ei"])
        if kirjutamine:
            easygui.msgbox("Tegid infotunnis märkmeid.")
            märkmed[
                "Infotund"] += " Ainetele ja eksamitele registreerimine ÕIS'is"
        else:
            easygui.msgbox("Sa ei teinud infotunnis märkmeid.")
    else:
        easygui.msgbox('Jätsid infotunnis käimata!', 'Väga halb!')
示例#57
0
def choicebutton(choices_list, title):
    choice_msg = "Wat wil je doen?"
    choice_title = title
    choice_buttons = choices_list
    choice_value = eg.buttonbox(
        choice_msg,
        choice_title,
        choice_buttons,
        None,
        None,
        choice_buttons[0],
    )
    if choice_value == None:
        return False
    else:
        return choice_value
示例#58
0
def write_images():
    global hypercube
    ext = easygui.buttonbox('Выберите формат сохранения слоёв', 'Формат',
                            ('.bmp', '.png'))
    fn = easygui.filesavebox(msg='Сохранить слои в ' + ext,
                             default='img_' + ext,
                             filetypes=[
                                 '*' + ext,
                             ])
    if fn:
        # cv2.imwrite(fn,hypercube[0]) - эта хрень не понимает русских букв в пути
        num_layers = hypercube.shape[0]
        fn = fn.split('.')[0]
        for i in range(num_layers):
            retval, buf = cv2.imencode(ext, hypercube[i])
            buf.tofile(fn + str(i) + ext)
示例#59
0
def respondToReply(reply, proteinsList, vegeList, carbsList, foodOptionsList,
                   foodList):
    if reply == "View List":
        # image = "has;kh;"
        msg = ""
        for item in foodList:
            msg += item[0] + " wants to eat:" + "\n" + "	"
            for i in range(1, len(item) - 1):
                msg += item[i] + ", "
            msg = msg[:-2]
            msg += "        Score: " + item[len(item) - 1] + "\n"
        scores = []
        best = ""
        highest = 0
        for item in foodList:
            if item[len(item) - 1] > highest:
                highest = item[len(item) - 1]
                best = item[0]
        msg += "\n\n TODAYS HEALTHIEST EATER IS:\n" + "		" + best
        choices = ["Back", "Family is fed, delete list"]
        reply = eg.buttonbox(msg, choices=choices)
        if reply == "Back":
            welcomeWindow(proteinsList, vegeList, carbsList, foodOptionsList,
                          foodList)
        else:
            foodList = ""
            welcomeWindow(proteinsList, vegeList, carbsList, foodOptionsList,
                          foodList)
    if reply == "What do I want to eat?":
        newItem = []
        nameReply = eg.enterbox(msg="My name is...")
        if nameReply:
            newItem.append(nameReply)
            chooseItems(foodOptionsList, newItem, carbsList, proteinsList,
                        vegeList, foodList)
        else:
            welcomeWindow(proteinsList, vegeList, carbsList, foodOptionsList,
                          foodList)
    if reply == "What's in your fridge?":
        foodOptionsList = sorted(vegeList + proteinsList + carbsList)
        if foodOptionsList[0] == "":
            foodOptionsList = foodOptionsList[1:]
        foodOptionsList = eg.multchoicebox(msg="What's in your fridge?",
                                           title="Choose Food",
                                           choices=foodOptionsList)
        welcomeWindow(proteinsList, vegeList, carbsList, foodOptionsList,
                      foodList)
示例#60
0
def main():
    done = ""
    while done != "QUIT":
        done = easygui.buttonbox(
            title="Welcome to PPEC Inventory System",
            msg="Choose an Option",
            choices=[
                "CREATE", "QUIT"
            ])  #easygui menu to either create a new batch or quit the program
        if done == "CREATE":
            newbatch(
            )  #if the user selects "create", it begins to create a new batch
        else:
            easygui.msgbox(
                msg="Goodbye"
            )  #if the user selects "Quit" or the exit button, this will quit the program
            quit(0)