0

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

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by bumsfeld
0

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)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.