用法:
turtle.setup(width=_CFG['width'], height=_CFG['height'], startx=_CFG['leftright'], starty=_CFG['topbottom'])
設置主窗口的大小和位置。參數的默認值存儲在配置字典中,可以通過
turtle.cfg
文件進行更改。- width:- 如果是整數,則為像素大小,如果是浮點數,則為屏幕的一部分;默認為屏幕的 50%
- height:- 如果是整數,則以像素為單位的高度,如果是浮點數,則為屏幕的一部分;默認為屏幕的 75%
- startx:- 如果為正,則從屏幕左邊開始以像素為單位,如果為負,則從右邊開始,如果
None
, 水平居中窗口 - starty:- 如果為正,則從屏幕上邊開始以像素為單位,如果為負,則從下邊開始,如果
None
, 垂直居中窗口
參數:
>>> screen.setup (width=200, height=200, startx=0, starty=0) >>> # sets window to 200x200 pixels, in upper left of screen >>> screen.setup(width=.75, height=0.5, startx=None, starty=None) >>> # sets window to 75% of screen by 50% of screen and centers
相關用法
- Python turtle.setundobuffer()用法及代碼示例
- Python turtle.setworldcoordinates()用法及代碼示例
- Python turtle.setx()用法及代碼示例
- Python turtle.settiltangle()用法及代碼示例
- Python turtle.sety用法及代碼示例
- Python turtle.settiltangle用法及代碼示例
- Python turtle.setx用法及代碼示例
- Python turtle.setheading用法及代碼示例
- Python turtle.seth()用法及代碼示例
- Python turtle.sety()用法及代碼示例
- Python turtle.setworldcoordinates用法及代碼示例
- Python turtle.speed()用法及代碼示例
- Python turtle.shapesize用法及代碼示例
- Python turtle.shape()用法及代碼示例
- Python turtle.screensize用法及代碼示例
- Python turtle.shape用法及代碼示例
- Python turtle.shapetransform()用法及代碼示例
- Python turtle.speed用法及代碼示例
- Python turtle.stamp用法及代碼示例
- Python turtle.showturtle()用法及代碼示例
注:本文由純淨天空篩選整理自python.org大神的英文原創作品 turtle.setup。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。