def main(search_in, filter_dic=filter_dic): results_sheet = Path(search_in) / 'FIJI_Results.xlsx' # template_sheet='/Users/papo/Sync/Projects/Annual_QA_pipeline/myexcel.xlsx' for key in filter_dic: file = find_file(filter_dic[key], search_in) df = pd.read_csv(file) position = position_dic[key] print( f'Copying the {key} results to position {position} from file:\n.../{file.name}\n' ) row, col = cellpos_to_rowcol(position) write_to_excel(df, str(results_sheet), sheet_name="FIJI_Results", index=False, startrow=row, startcol=col) # print(f'Copying all FIJI results into the main excel sheet...') # fiji = pd.read_excel(results_sheet) # write_to_excel(fiji,template_sheet, sheet_name="FIJI_Results", index=False, header=False) easygui_qt.show_message( message= f'Done!\n Now copy the results in {results_sheet} into the template excel sheet.' )
def end_game(the_time): """This non-fruitful function represetnts the gretting messages and time calculation of the game after user victory.""" time_used = time.time() - the_time microbit.display.scroll("You win!") easy.show_message( "Great work, you win! It took you " + str(int(time_used)) + " seconds to complete the game!", "Victory!") easy.show_message("Hope that you enjoyed the game!", "Game Over!") time.sleep(2) microbit.display.clear()
def main(): conn = sqlite3.connect("garde.db") c = conn.cursor() date = easy.get_date() easy.set_font_size(20) Message = "Add to the database the " + str(date) Title = "Confirm write to the database" easy.show_message(message=Message, title=Title) c.execute("INSERT INTO repas VALUES (?, ?);", (date, "Repas Enfant")) conn.commit() conn.close()
def guessing_game(): name = eg.get_string(message="What is your name?", title="Mine is Reeborg.") if not name: name = "Unknown person" message = """<p>The following language selection will only affect the default GUI elements like the text on the buttons. Note that <b>Default</b> is reverting back to the local PyQt default (likely English).</p>""" eg.show_message(message=message, title="For information") eg.get_language() eg.show_message(message="Hello {}. Let's play a game".format(name), title="Guessing game!") guess = min_ = 1 max_ = 50 answer = randint(min_, max_) title = "Guessing game" while guess != answer: message = "Guess a number between {} and {}".format(min_, max_) prev_guess = guess guess = eg.get_int(message=message, title=title, default_value=guess, min_=min_, max_=max_) if guess is None: quitting = eg.get_yes_or_no("Do you want to quit?") guess = prev_guess if quitting: break elif guess < answer: title = "Too low" min_ = guess elif guess > answer: title = "Too high" max_ = guess else: message = "Congratulations {}! {} was the answer.".format(name, guess) eg.show_message(message, title="You win!")
answer = randint(min_, max_) title = "Guessing game" while guess != answer: message = "Guess a number between {} and {}".format(min_, max_) prev_guess = guess guess = eg.get_int(message=message, title=title, default_value=guess, min_=min_, max_=max_) if guess is None: quitting = eg.get_yes_or_no("Do you want to quit?") guess = prev_guess if quitting: break elif guess < answer: title = "Too low" min_ = guess elif guess > answer: title = "Too high" max_ = guess else: message = "Congratulations {}! {} was the answer.".format(name, guess) eg.show_message(message, title="You win!") if __name__ == "__main__": eg.show_message("Temporarily setting the locale to Spanish.") eg.set_language("es") eg.show_message("Increasing the font size to 14.") eg.set_font_size(14) guessing_game() eg.set_font_size(12) eg.show_message("Changed the font size down to 12.")
import easygui_qt as easy person1 = "Jenna" person2 = "Therrill" the_message = f"""<h1>Class List</h1> <p>The people in our <em>Computer Science 20</em> class includes:</p> <ul> <li>{person1}</li> <li>{person2}</li> <li>Ashton</li> <li>Josiah</li> <li>Agnes</li> </ul>""" easy.show_message(the_message)
dots.goto(location) dots.dot() if turtles_are_touching(alba, dots, 20): dots.hideturtle() dots.goto(location) dots.dot() #using tilt and direction functions to move turtle while not turtles_are_touching(alba, dots, 20): tilt = tilt_direction(200) alba.penup() if turtles_are_touching(alba, dots, 20): score = score + 1 else: if tilt == "right": move_right(alba) elif tilt == "left": move_left(alba) elif tilt == "up": move_up(alba) elif tilt == "down": move_down(alba) else: microbit.display.show("-") easy.show_message("finished") wn.exitonclick()
# Takes the elements in a matrix row and concatenate them so I can concatenate all the rows into proper microbit image display format. for index_1 in range(microbit_treasure_image.shape[0]): image_of_row = "" for index_2 in range(microbit_treasure_image.shape[1]): image_of_row = image_of_row + str(microbit_treasure_image[index_1, index_2]) image_of_treasure = image_of_treasure + image_of_row + ":" treasure_image = microbit.Image(image_of_treasure.rstrip(":")) microbit.display.show(treasure_image) time.sleep(1) microbit.display.clear() # Control explanation for the player. easy.show_message( "Tilt microbit right to turn the turtle clockwise and left for counter-cloockwise. Tilt forwards to move the turtle. Press the a button to search for a treasure under the turtle or the b button to use the compass to hunt for the treasure.", "Instructions") # Sets up the screen and turtle. wn = turtle.Screen() wn.setworldcoordinates(-1000, -1000, 1000, 1000) wn.bgcolor("white") turt = turtle.Turtle() turt.up() turt.home() # Creates a random amount of treasure locations and puts them in a array. The minimum amount is 3 and maximum amount is 7. # For all coord_treasure_locations[index][0], that is the x value while coord_treasure_locations[index][1] is the y value. coord_treasure_locations = [] for amount_treasure in range(randint(3, 7)): coord_treasure_locations.append(
def restart_game(): """This non-fruitful function repersents the notices given and the retarting of the game by the microbit if the user reaches 5 losses.""" microbit.display.scroll("You lose!") easy.show_message("You reached 5 losses, please try again!")
def end_game(the_time): """This non-fruitful function represetnts the gretting messages and time calculation of the game after user victory.""" time_used = time.time() - the_time microbit.display.scroll("You win!") easy.show_message( "Great work, you win! It took you " + str(int(time_used)) + " seconds to complete the game!", "Victory!") easy.show_message("Hope that you enjoyed the game!", "Game Over!") time.sleep(2) microbit.display.clear() #introduction message to player and instructions on the game easy.show_message( """Welcome to the Line of Death game. Press A when you think the dot is on the line and press b to check your score. Reach 15 wins to win or 5 losses to lose. Good Luck!""", "Line of Death") #initial settings including the default image and basic variables such as wins and looses position = [ "90400:", "09400:", "00900:", "00490:", "00409:", "00490:", "00900:", "09400:" ] default_image = "00400:" + "00400:" + "00400:" + "00400:" + "00400:" default_image = microbit.Image(default_image) wins = 0 losses = 0 sleep_time = 1 start_time = time.time() #the game loop that will end after reaching 15 wins
ben.left(90) #puts turtle into position for 2nd row of seeds draw_seeds(4, ben) ben.right(90) ben.forward(65) ben.right(90) ben.forward(120) #puts turtle into position for final row draw_seeds(3, ben) elif choice == "Free drawing": ben = turtle.Turtle() canvas = turtle.Screen() #Makes a turtle and it's properties ben.speed(0) easy.show_message( "W-A-S-D, controls, Space bar selects a random color, Q grows and E shrinks, C clears the screen, Color Away :]", "Free Drawing") if True: #If the () key is pressed, does the "()" command turtle.onkeypress(up, "w") turtle.onkeypress(down, "s") turtle.onkeypress(right, "d") turtle.onkeypress(left, "a") turtle.onkeypress(color, "space") turtle.onkeypress(grow, "q") turtle.onkeypress(shrink, "e") turtle.onkeypress(clear, "c") turtle.listen() time.sleep(5) #A small pause to keep the program at a tolerable pace
import easygui_qt as easy your_fav = easy.get_string("What's your favourite NBA team?") best_teams = f"""<h1>Best NBA Teams</h1> <p>The <em>best teams</em> in the NBA are:</p> <ul> <li>Spurs</li> <li>Warriors</li> <li>Celtics</li> <li>Raptors</li> <li>{your_fav}</li> </ul>""" easy.show_message(best_teams)
#!/usr/bin/env python3 import json import os, sys from common import run_scanner_main, check_config import easygui_qt as egui import glob import subprocess if __name__ == '__main__': curr_path = os.path.dirname(os.path.abspath(__file__)) config_path = curr_path + '/configs' conf_files = glob.glob1(config_path, '*.json') if len(conf_files) == 0: egui.show_message('No config files found in {} !!'.format(config_path)) sys.exit(-1) # endif # Select config config_t = egui.get_choice('Select config to run.', choices=conf_files) if config_t == None: egui.show_message('No choice selected !!') sys.exit(-1) # endif down_csvs = egui.get_yes_or_no('Download csv files ??') take_backup = egui.get_yes_or_no('Backup downloaded csv files ?') open_final = egui.get_yes_or_no('Open final report file ?') # Override config_json = json.load(open(config_path + '/' + config_t)) config_json['download_csvs'] = down_csvs
import easygui_qt as easy subjects = [ "Computer Science", "Math", "Health Science", "SPED", "Spanish", "Pysch", "History" ] favourite = easy.get_choice("Which subject is your favourite?", "Subject Picker", subjects) easy.show_message("I like " + favourite + " too!")
import easygui_qt as easy courses = [ "Science", "Math", "Computer Science", "Law", "SPED", "Accounting", "History", "Mechanics", "Photography", "French" ] fav = easy.get_choice("Which course is the best?", "Pick Course", courses) if fav == "Mechanics": easy.show_message("Hey, can you help me with my car?") elif fav == "Computer Science": easy.show_message("Are you just being nice?") else: easy.show_message("Nice! I like " + fav + " too!")
prev_guess = guess guess = eg.get_int(message=message, title=title, default_value=guess, min_=min_, max_=max_) if guess is None: quitting = eg.get_yes_or_no("Do you want to quit?") guess = prev_guess if quitting: break elif guess < answer: title = "Too low" min_ = guess elif guess > answer: title = "Too high" max_ = guess else: message = "Congratulations {}! {} was the answer.".format(name, guess) eg.show_message(message, title="You win!") if __name__ == '__main__': eg.show_message("Temporarily setting the locale to Spanish.") eg.set_language('es') eg.show_message("Increasing the font size to 14.") eg.set_font_size(14) guessing_game() eg.set_font_size(12) eg.show_message("Changed the font size down to 12.")
import easygui_qt as easy first_name = easy.get_string("Please enter your first name") last_name = easy.get_string("Please enter your last name") greeting = "Hello there, " + first_name + " " + last_name + "!" easy.show_message(greeting)
def game_loop(self): """ Fonctionnement logique de la partie """ self.echiquier.blit(self.screen) self.__init_pieces() if self.game.mode_de_jeu is not ModeDeJeu.MACHINE_MACHINE: self.undo_button.blit(self.screen) self.list_button.blit(self.screen) self.recommencer.blit(self.screen) pygame.display.flip() # Indique si la partie est terminée done = False # Boucle principale while not done: if isinstance(self.game.get_active_player(), Humain): for event in pygame.event.get(): pieceTemp = None if event.type == pygame.QUIT: sys.exit(0) elif event.type == pygame.MOUSEBUTTONDOWN: self.position_curseur = pygame.mouse.get_pos() for i in self.liste_piece: for j in i: if j is not None and j.image.get_rect().move( j.position[0], j.position[1]).collidepoint( self.position_curseur): pieceTemp = j if pieceTemp is not None and (self.game.tour_blanc == pieceTemp.estBlanc or pieceTemp.estVert): self.__show_possible_moves(pieceTemp) done = self.__check_mat() vert = None for temp in self.liste_vert: if temp.image.get_rect().move( temp.position[0], temp.position[1]).collidepoint( self.position_curseur): vert = temp if vert is not None: self.__move(vert) done = self.__check_mat() self.__board_to_interface() # si on clique sur le boutton undo (commentaire pour le if suivant) elif self.game.memoire.numero_move != 0 and self.undo_button.image.get_rect( ).move(self.undo_button.position[0], self.undo_button.position[1]).collidepoint( self.position_curseur): if self.game.mode_de_jeu == ModeDeJeu.JOUEUR_JOUEUR: self.game.undo() else: self.game.undo() self.game.undo() self.__board_to_interface() elif self.list_button.image.get_rect().move( self.list_button.position[0], self.list_button.position[1]).collidepoint( self.position_curseur): liste_moves = '' for i in self.game.memoire.tous_move: liste_moves += i + '\n' easygui_qt.show_message(liste_moves, 'Liste des moves') elif self.recommencer.image.get_rect().move( self.recommencer.position[0], self.recommencer.position[1]).collidepoint( self.position_curseur): self.__restarting() else: self.game.next() done = self.__check_mat() self.__board_to_interface() pygame.display.flip() restart = self.__choix_quitter() if restart: self.__restarting()