Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
1_bit
draw_pixel
提交
c516c77d
D
draw_pixel
项目概览
1_bit
/
draw_pixel
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
draw_pixel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c516c77d
编写于
2月 13, 2021
作者:
1_bit
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add new file
上级
e752ca3f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
76 addition
and
0 deletion
+76
-0
drawTools.py
drawTools.py
+76
-0
未找到文件。
drawTools.py
0 → 100644
浏览文件 @
c516c77d
from
core
import
Core
from
turtle
import
*
class
Tools
(
Core
):
width
,
height
=
0
,
0
def
__init__
(
self
,
open
=
False
,
helperline
=
'red'
):
width
=
window_width
()
height
=
window_height
()
#行列
lines
=
int
(
height
/
10
)
rows
=
int
(
width
/
10
)
#左上角
leftx
=-
int
(
width
/
2
)
topy
=
int
(
height
/
2
)
self
.
goto_
((
leftx
,
topy
))
if
open
==
True
:
for
l
in
range
(
lines
):
nowpos
=
pos
()
-
(
0
,
0
)
self
.
line
(
rows
,
10
,
pcolor
=
helperline
)
topy
-=
10
self
.
goto_
((
leftx
,
topy
))
qx
,
qy
=-
160
,
160
self
.
goto_
((
qx
,
qy
))
for
l
in
range
(
32
):
nowpos
=
pos
()
-
(
0
,
0
)
self
.
line
(
32
,
10
,
pcolor
=
"blue"
)
qy
-=
10
self
.
goto_
((
qx
,
qy
))
qx
,
qy
=-
80
,
80
self
.
goto_
((
qx
,
qy
))
for
l
in
range
(
16
):
nowpos
=
pos
()
-
(
0
,
0
)
self
.
line
(
16
,
10
,
pcolor
=
"green"
)
qy
-=
10
self
.
goto_
((
qx
,
qy
))
qx
,
qy
=-
20
,
20
self
.
goto_
((
qx
,
qy
))
for
l
in
range
(
4
):
nowpos
=
pos
()
-
(
0
,
0
)
self
.
line
(
4
,
10
,
pcolor
=
"red"
)
qy
-=
10
self
.
goto_
((
qx
,
qy
))
self
.
goto_
((
0
,
0
))
#绘制线段 'length:2;direction:down;fcolor:black;pos:(0,-100);symmetrical:13'
def
drawlines
(
self
,
drawcon
=
[],
startpos
=
(
0
,
0
)):
for
c
in
drawcon
:
c_val
=
c
.
split
(
';'
)
length
=
0
direction
=
''
fcolor
=
''
posv
=
None
symmetrical
=
'f'
symmetrical_direction
=
"right"
line_type
=
'line'
for
v
in
c_val
:
demens
=
v
.
split
(
':'
)
if
demens
[
0
]
==
'length'
:
length
=
int
(
demens
[
1
])
elif
demens
[
0
]
==
'direction'
:
direction
=
demens
[
1
]
elif
demens
[
0
]
==
'fcolor'
:
fcolor
=
demens
[
1
]
elif
demens
[
0
]
==
'pos'
:
posval
=
demens
[
1
].
split
(
','
)
posv
=
(
int
(
posval
[
0
])
+
startpos
[
0
],
int
(
posval
[
1
])
+
startpos
[
1
])
elif
demens
[
0
]
==
'symmetrical'
:
symmetrical
=
int
(
demens
[
1
])
elif
demens
[
0
]
==
'symmetrical_direction'
:
symmetrical_direction
=
demens
[
1
]
elif
demens
[
0
]
==
'line_type'
:
line_type
=
demens
[
1
]
self
.
goto_
(
posv
)
if
line_type
==
'line'
:
self
.
line
(
length
,
fcolor
=
fcolor
,
direction
=
direction
,
symmetrical
=
symmetrical
,
symmetrical_direction
=
symmetrical_direction
)
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录