[Python] Is possible to execute 2 or more windows (Tk) of turtle at the same time from the...

Discussão em 'Python' iniciado por Stack, Setembro 14, 2025.

  1. Stack

    Stack Membro Participativo

    Since make one drawing with two turtles at the same time in 1 tk window dont work very well, i was wondering if its easier to draw each part of the drawing in a diferent window at the same time.

    Ex :

    from turtle import Screen, Turtle
    import random

    screen = Screen()
    t = Turtle(visible=False)
    t.speed('fastest') # because I have no patience

    def got(x,y,d) :
    t.penup()
    t.goto(x,y)
    t.pendown()
    t.seth(d)


    def tuneis(ragn):
    d=0
    for i in range(ragn):

    got(0,0,d)
    d = d + 10
    t.penup()

    t.forward(400)
    t.pendown()
    t.forward(500)

    tuneis(36)
    real = []

    def realidade(ragn) :
    d=5
    for i in range(ragn):
    b = random.randint(10,50)
    t.pensize(b)
    t.color('green')
    got(0,0,d)
    real.append(b)
    d = d + 10
    t.penup()

    t.forward(450)
    t.pendown()
    t.forward(500)

    realidade(36)

    def filo(x,y):
    cont = x
    t.color('green')
    for i in real:

    t.pensize(0)
    #b=random.randint(10,50)

    got(cont,y,0)
    cont = cont + 10

    t.setheading(270)
    t.forward(i)
    y= y + 20
    cont = cont - (len(real)*10 / 2)
    d=0
    for i in real :
    got(cont,y,d)
    t.forward(i)
    d=d+5


    filo(-200,300)


    Would be possible to draw "tuneis" and "realidade" in one window, and "filo" in another window at the same time ?

    Continue reading...

Compartilhe esta Página