Черепаха. Установить начальную позицию окна приложения - PullRequest
0 голосов
/ 18 мая 2019

Я пытаюсь установить стартовое окно для моего первого сценария черепахи, но после некоторого поиска кажется, что нет чистого способа сделать это.

1 Ответ

0 голосов
/ 19 мая 2019

после некоторого поиска кажется, что нет чистого способа сделать это

Что вы подразумеваете под clean ?Вы можете установить начальный размер и начальную позицию окна черепахи, используя метод setup():

>>> import turtle
>>> help(turtle.setup)
Help on function setup in module turtle:

setup(width=0.5, height=0.75, startx=None, starty=None)
    Set the size and position of the main window.

    Arguments:
    width: as integer a size in pixels, as float a fraction of the 
      Default is 50% of 
    height: as integer the height in pixels, as float a fraction of the
       Default is 75% of 
    startx: if positive, starting position in pixels from the left
      edge of the screen, if negative from the right edge
      Default, startx=None is to center window horizontally.
    starty: if positive, starting position in pixels from the top
      edge of the screen, if negative from the bottom edge
      Default, starty=None is to center window vertically.

Например:

from turtle import Screen, Turtle

screen = Screen()
screen.setup(300, 300, startx=100, starty=200)

turtle = Turtle()
turtle.dot(100)

screen.mainloop()
...