Last active
March 24, 2020 16:06
-
-
Save lelahx/b5619d819864c89af4d0433c4ed22d7a to your computer and use it in GitHub Desktop.
Revisions
-
lelahx revised this gist
Mar 24, 2020 . 1 changed file with 8 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,20 +4,17 @@ # Type de fichier: .pbm ou .pgm # Largeur et longueur fichier = "pbm 24 7" # Chaine chaine = """ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 """ # Ne modifiez le code que si -
lelahx revised this gist
Mar 24, 2020 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,7 @@ fichier = "pbm 7 10" # Chaine chaine = """ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 -
lelahx revised this gist
Mar 24, 2020 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,9 @@ fichier = "pbm 7 10" # Chaine chaine = """ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 @@ -16,7 +18,8 @@ 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 """ # Ne modifiez le code que si # vous savez ce que vous faites -
lelahx revised this gist
Mar 24, 2020 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,16 @@ fichier = "pbm 7 10" # Chaine chaine = """0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0""" # Ne modifiez le code que si # vous savez ce que vous faites -
lelahx revised this gist
Mar 24, 2020 . 1 changed file with 110 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,110 @@ from kandinsky import fill_rect, draw_string from time import sleep from ion import * # Type de fichier: .pbm ou .pgm # Largeur et longueur fichier = "pbm 7 10" # Chaine chaine = "0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0" # Ne modifiez le code que si # vous savez ce que vous faites fichier = fichier.split() largeur = int(fichier [1]) hauteur = int(fichier [2]) chaine = chaine.replace("0", "255") chaine = chaine.split() zoom = 1 affichage_barre = True # Detemination du type de fichier if fichier[0] == "pbm": nb_octet_nuance = 0.125 elif fichier[0] == "pgm": nb_octet_nuance = 0.125 # Determination du poid et de #l'unite adaptee a ce dernier poid = (largeur*hauteur)*nb_octet_nuance if poid <= 1: poid = str(poid/1024) + " Ko " else: poid = str(poid) + " o " # Dessin de l'arriere plan fill_rect(0, 0, 320, 222, (192, 53, 53)) def image(zoom): x = 0 y = 0 iterateur = 0 for k in range(len(chaine)): p = int(chaine[iterateur]) iterateur += 1 fill_rect(x, y, zoom, zoom, (p, p, p)) x += zoom if x == largeur*zoom: x = 0 y += zoom try: while 1: image(zoom) if zoom == 0: zoom = 1 elif (hauteur*zoom)/222 > 1: zoom -= 1 else: if keydown(KEY_BACK): break elif keydown(KEY_PLUS): sleep(.00175) zoom += 1 elif keydown(KEY_MINUS): sleep(.00175) zoom -= 1 elif keydown(KEY_OK) or keydown(KEY_TOOLBOX) or keydown(KEY_EXE): sleep(.004) if affichage_barre: affichage_barre = False elif affichage_barre == False: affichage_barre = True fill_rect(largeur*zoom, 0, 16, hauteur*zoom, (192, 53, 53)) fill_rect(0, hauteur*zoom - zoom, largeur*zoom + 8, 12, (192, 53, 53)) if affichage_barre: draw_string(str("Taille:" + str(largeur) + "*" + str(hauteur) + " px " + "Zoom:" + str(zoom*100) + "% " + poid), 0, 205, (255, 255, 255), (192, 53, 53)) else: fill_rect(0, 205, 320, 17, (192, 53, 53)) except KeyboardInterrupt: print(31*"_" + "\n\n\n Merci d'utiliser IBM\n\n\n" + 31*"_") -
lelahx created this gist
Mar 24, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ from math import *