Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with pillow
#1
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.

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()
Reply


Messages In This Thread
Problem with pillow - by Lucasesdou - May-16-2018, 06:47 PM
RE: Problem with pillow - by woooee - May-16-2018, 08:25 PM
RE: Problem with pillow - by Lucasesdou - May-17-2018, 10:07 PM
RE: Problem with pillow - by woooee - May-18-2018, 12:15 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020