I'm trying to make the canvas (or window) created from the turtle module, but the code listed in the docs at python.org doesn't work. I've done some research online, and I keep coming across 'Tkinter', which is only confusing me further. I'm trying to make a soduko game, but first I need the canvas (window) to be bigger than the default size. I've tried both when trying to create the grid:

setup(width=#, height=#, startx=#, starty=#)
turtle.setup(width=#, height=#, startx=#, starty=#)

Any help will be greatly appreciated. Thanks in advance.

Cheers,
Devon

The module turtle is part of the Tkinter GUI toolkit. Here is small example:

# module turtle is part of Tkinter

import turtle
import time

def tdraw_x(n):
    """
    draw one turtle x of size n
    turtle starts in the center of canvas (0, 0) by default
    """
    t3 = turtle.Pen()

    for k in (1, 2):
        if k == 1:
            t3.left(60)
        else:
            t3.right(120)

        t3.forward(n)
        t3.left(60)
        t3.forward(n)
        t3.right(120)
        t3.forward(n)
        t3.right(60)
        t3.forward(n/2)
        t3.left(120)
        t3.forward(n/2)
        t3.right(60)
        t3.forward(n)

tdraw_x(50)     # test
time.sleep(10)  # show test for some seconds (just for test)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.