def pick_files_individual(data, path): ''' Picks files one by one from a given path data - StitchData to put textures into path - Base path of StitchData ''' data.tex_width = util.input_int("How wide is each texture? ") data.tex_height = util.input_int("How tall is each texture? ") data.width = util.input_int( "How many textures wide should the output be? ") print("Input a list of textures from top to bottom: ") while True: file_path = util.get_in_filename(initialdir=path, title="Select an image", filetypes=util.FILES_IMG) if file_path == "": break data.texlist.append(file_path) print(file_path)
def install(self): # Get ID id = input_int("Donnez l'id: ", 1, 65535) pin = input_int("Donnez le code PIN: ", 0, 9999) name = input_str("Donnez le nom: ", max_length=15, alphabet=alphabet) # Get Name print("id",id, "- PIN",pin,"- nom", name) self.add_user(id, name) id = struct.pack("!H", id) pin = struct.pack("!H", pin) name_length = struct.pack("B", len(name)) name = name.encode() signature = private_key.sign(id+name) args = id+pin+name_length+name+signature debug("signature", signature) debug("param array", args) args = a2h(args) debug("param hex", args) print("gp -v --install RockSaclay221.cap --params", args)
def vendre(self): # Vérifier si la carte est vérouillé if not self.get_tries_remaning(): print("0 Essay restant, carte vérouillé") sys.exit(1) # Insertion PIN while True: pin = input_int("Insérez votre code PIN: ", 0, 9999) checked, attempt = self.check_pin(pin) if checked: print("code PIN bon") break # bad pin if attempt: print("code PIN faux, essaye restant", attempt) continue # no more pin else: print("0 Essay restant, carte vérouillé") break print() # user information print("---- information utilisateur ----") print("id:", self.get_id()) print("nom:", self.get_name()) print("credits:", self.get_credits()) print() # Debiter print("---- debiter montant ----") debit = input_int("Choisir montant à débiter: ", min=0, max=MAX_SHORT) try: self.debit_credits(debit) print("Crédit restant", self.get_credits()) except SW_INSUFFICIENT_CREDITS: print("Solde insufisant", self.get_credits()) print()
class RoRockSaclayVente(): def vendre(self): pass if __name__ == "__main__": print("---- Rock Saclay Vente ----") print("Insérez votre carte") vente = RoRockSaclayVente() while True: print("Choisir une action") print("1) Vendre à un client") print("2) Quitter") choix = input_int("> ", min=1, max=2) if choix == 1: client = ClientRockSaclay() client.wait_carte() client.select() client.verify() client.vendre() elif choix == 2: break print()
import sys sys.path.append("gubg.io/src") import word import util book = word.Book.load("vestibulum.naft") print("Hallo Tibe, ben je er klaar voor?") six = util.input_int(f"Van waar wil je beginnen?", 1, len(book)) eix = util.input_int(f"Tot waar wil je gaan?", 1, len(book)) book.prune(six - 1, eix) nr = util.input_int( f"Hoeveel woorden wil je afvragen? Maximum is {len(book)}.", 1, len(book)) score = util.Score() subset = book.select_subset(nr) for ix, word in enumerate(subset): print(f"\n{ix+1}/{nr}: {word.latin}") input("Duw op <enter> voor het antwoord") def hr(v, fill=" "): str = v if v else "" return str.ljust(20, fill) def gender(v): if v == "m": return "m."