Hello, I made a program with python and I use pillow for open images, the problem is that When I open an image, the program is finished and I can't put loop or anything else, if I do it, it just do the second action and it not opening the image. What could I do ?
for example If I want to print something after the image has open like "congratulation", it will only write the word and won't open the image.
for example If I want to print something after the image has open like "congratulation", it will only write the word and won't open the image.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
from tkinter import * from PIL import ImageTk,Image Images = { 1 : "2Homo nonhabilis.jpeg" , 2 : "3Pas le feu.jpeg" , 3 : "4ne decouvre pas lart.jpeg" , 4 : "5roue.jpeg" , 5 : "6ecriture.jpeg" , 6 : "pyramide.jpeg" , 7 : "8republic ath.jpeg" , 8 : "9J-C.jpeg" , 9 : "10boussole.jpeg" , 10 : "11christophe colomb.jpeg" , 11 : "12terreplate.jpeg" , 12 : "13 droit de lhomme.jpeg" , 13 : "14 automobile.jpeg" , 14 : "15ww1.jpeg" , 15 : "16ww2.jpeg" } def un(): text1 = int ( input ( "Voir la frise normale(1) ou modifier la frise normale(2)" )) if text1 = = 1 : frisenormal() if text1 = = 2 : tout() while text1 ! = 1 or 2 : print ( "\n Erreur: Veuillez saisir un chiffre valide. \n" ) un() def frisenormal(): main = Tk() main.geometry( "1260x625+100+100" ) main.title( 'Frise du monde' ) canvas = Canvas(main,width = 1300 ,height = 650 ) canvas.place(relx = 0 ,rely = 0 ) im = Image. open ( "1NORMALE.jpeg" ) canvas.image = ImageTk.PhotoImage(im) canvas.create_image( 0 , 0 ,image = canvas.image,anchor = 'nw' ) def frise(img): main = Tk() main.geometry( "1260x625+100+100" ) main.title( 'Frise du monde' ) canvas = Canvas(main,width = 1300 ,height = 650 ) canvas.place(relx = 0 ,rely = 0 ) im = Image. open (img) canvas.image = ImageTk.PhotoImage(im) canvas.create_image( 0 , 0 ,image = canvas.image,anchor = 'nw' ) def tout(): with open ( "ztext.txt" , "r" ) as file_object: print (file_object.read()) tout2() def tout2(): texte3 = int ( input ( "choisisez un nombres: " )) frise(Images[texte3]), return un() |