Hi, 

so for a projet with my school I had to use turtle with a background image 
witch is a planisphere.

I mad my code on the IDLE of python and it works but I have to make it work 
with pyzo for my school and I can't figure out why the same code doesn't work 
and what I have to change to make it work on pyzo.

Here is my code: 


import random
import turtle

fortify = turtle.Turtle()
fortify.hideturtle()
turtle.hideturtle()
fortify.screen.bgpic("planisphere.gif")
turtle.setup (width=1220, height=710, startx=350, starty=180)
turtle.penup()
#position des villes 
Astana = [197,87,"Astana"]
Buenos_Aires = [-235,-240,"Buenos_Aires"]
Canberra = [457,-243,"Canberra"]
Copenhague = [6,110,"Copenhague"]
Johannesburg = [57,-204,"Johannesburg"]
Lagos = [-26,-93,"Lagos"]
Los_Angeles = [-430,0,"Los_Angeles"]
Mexico = [-370,-45,"Mexico"]
Moscou = [90,105,"Moscou"]
Mumbai = [205,-52,"Mumbai"]
New_York = [-290,30,"New_York"]
Ottawa = [-290,55,"Ottawa"]
Paris = [-30,68,"Paris"]
Pekin = [350,28,"Pekin"]
Perth = [347,-216,"Perth"]
Tokyo = [425,10,"Tokyo"]
Zagreb = [18,56,"Zagreb"]

List = 
[Ottawa,Los_Angeles,Mexico,New_York,Buenos_Aires,Paris,Copenhague,Zagreb,Moscou,Lagos,Johannesburg,Astana,Mumbai,Pekin,Tokyo,Perth,Canberra]
random.shuffle(List)

#on créé les procédures qui permettront le bon tracé
def gauche():
    turtle.goto(-596,(List[i-1][1]+List[i][1])/2)
    turtle.penup()
    turtle.goto(596,(List[i-1][1]+List[i][1])/2)
    turtle.pendown()
def droite():
    turtle.goto(596,(List[i-1][1]+List[i][1])/2)
    turtle.penup()
    turtle.goto(-596,(List[i-1][1]+List[i][1])/2)
    turtle.pendown()
#ici commence le programme
turtle.pensize(2)
turtle.pencolor("red")
message = "Départ : "
for i in range(0,len(List)):
    print(message + List[i][2])  
    message = "Escale " + str(i+1) + " : "
    if i > 0:

        if List[i-1][0] < 0 and List[i][0] > 0:
            
            
            if abs(List[i-1][0]) + abs(List[i][0]) > 
(596-abs(List[i-1][0])+596-abs(List[i][0])) :
                gauche()
                

        elif List[i-1][0] > 0 and List[i][0] < 0:
            
           
            if abs(List[i-1][0]) + abs(List[i][0]) > 
(596-abs(List[i-1][0])+596-abs(List[i][0])) :

                droite()
                
           
    turtle.goto(List[i][0],List[i][1])
    if i == len(List)-2:
        message = "Arrivé : "
    if i == len(List)-1:
        turtle.pencolor("red")
    turtle.write(List[i][2], font= ("Arial",15,'bold'))
    turtle.pencolor("black")
    turtle.pendown()

-- 
You received this message because you are subscribed to the Google Groups 
"Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/pyzo/afd1ebd5-53ef-484f-aec1-ff4e7af61ea2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to