質問するログイン新規登録

質問編集履歴

9

画像の追加、コードの追加

2020/04/06 11:13

投稿

GuMasi
GuMasi

スコア73

title CHANGED
File without changes
body CHANGED
@@ -106,4 +106,38 @@
106
106
  ```
107
107
 
108
108
  実行結果
109
- ![イメージ説明](7771a217c22bf26ad5e7d53e77ceeebf.png)
109
+ ![イメージ説明](7771a217c22bf26ad5e7d53e77ceeebf.png)
110
+
111
+ 追記:6
112
+
113
+
114
+ setpos数値変更
115
+    ```python
116
+ from turtle import *
117
+
118
+ with open("motion.log", encoding= "utf-8") as stream:
119
+ write("Apple", None, "center", "serif 64 bold")
120
+ color("red")
121
+ penup()
122
+ pensize(4)
123
+
124
+ # XXX: キャンバスの絶対座標で記録されてるので、タートル中心の座標に修正(数値は適当)
125
+ for line in stream:
126
+ action, *args = line.strip().split(" ")
127
+ print(action, args)
128
+ if action == "setpos":
129
+ x, y = map(int, args)
130
+ setpos(x-360, -y+340)
131
+ elif action == "pendown":
132
+ x, y = map(int, args)
133
+ setpos(x-360, -y+340)
134
+ pendown()
135
+ elif action == "penup":
136
+ penup()
137
+
138
+ hideturtle()
139
+ done()
140
+ ```
141
+
142
+ 実行結果
143
+ ![イメージ説明](e61c6da8751c76e943516f01783c6639.png)

8

画像の追加、コードの追加

2020/04/06 11:13

投稿

GuMasi
GuMasi

スコア73

title CHANGED
File without changes
body CHANGED
@@ -44,4 +44,66 @@
44
44
 
45
45
  追記4:エラーの出力内容、バージョンの確認。
46
46
 
47
- ![イメージ説明](b227106a3e55f549981ff1ca0eaf7063.png)
47
+ ![イメージ説明](b227106a3e55f549981ff1ca0eaf7063.png)
48
+
49
+ 追記5: 該当部分のコード
50
+    
51
+    ```python
52
+ '''
53
+ from turtle import *
54
+
55
+ with open("handwriting-apple.txt", encoding="utf-8") as stream:
56
+ write("Apple", None, "center", "serif 64 bold")
57
+ color("red")
58
+ penup()
59
+ pensize(4)
60
+
61
+ # : キャンバスの絶対座標で記録されてるので、タートル中心の座標に修正(数値は適当)
62
+ for line in stream:
63
+ action, *args = line.strip().split(" ")
64
+ print(action, args)
65
+ if action == "setpos":
66
+ x, y = map(int, args)
67
+ setpos(x-480, -y+400)
68
+ elif action == "pendown":
69
+ x, y = map(int, args)
70
+ setpos(x-480, -y+400)
71
+ pendown()
72
+ elif action == "penup":
73
+ penup()
74
+
75
+ hideturtle()
76
+ done()
77
+ '''
78
+
79
+ # 実行方法: python record_motion.py > handwriting-apple.txt
80
+ import sys
81
+ sys.stdout = open("motion.log", "w", encoding = "utf-8")
82
+ from turtle import *
83
+
84
+ s = Screen()
85
+ t = Turtle()
86
+
87
+ def onmotion(e):
88
+ print("setpos {} {}".format(e.x, e.y))
89
+
90
+ def onrelease(e):
91
+ print("penup")
92
+ s.cv.unbind("<Motion>")
93
+ s.cv.unbind("<ButtonRelease-1>")
94
+
95
+ def onpress(e):
96
+ print("pendown {} {}".format(e.x, e.y))
97
+ s.cv.bind("<Motion>", onmotion)
98
+ s.cv.bind("<ButtonRelease-1>", onrelease)
99
+
100
+ s.cv.bind("<ButtonPress-1>", onpress)
101
+ t.write("Apple", None, "center", "serif 64 bold")
102
+ t.hideturtle()
103
+ done()
104
+
105
+
106
+ ```
107
+
108
+ 実行結果
109
+ ![イメージ説明](7771a217c22bf26ad5e7d53e77ceeebf.png)

7

画像の追加

2020/04/04 14:17

投稿

GuMasi
GuMasi

スコア73

title CHANGED
File without changes
body CHANGED
@@ -40,4 +40,8 @@
40
40
 
41
41
  ![イメージ説明](3698f98bc92e26f70186d439fe7025b2.png)
42
42
 
43
- replayファイル
43
+ replayファイル
44
+
45
+ 追記4:エラーの出力内容、バージョンの確認。
46
+
47
+ ![イメージ説明](b227106a3e55f549981ff1ca0eaf7063.png)

6

画像の追加

2020/04/03 06:33

投稿

GuMasi
GuMasi

スコア73

title CHANGED
File without changes
body CHANGED
@@ -32,4 +32,12 @@
32
32
  追記2:
33
33
   .pyファイルに記録用のコードを記述し実行後
34
34
 
35
- ![イメージ説明](26cb4c235e523642cd4bffcf59a1a5b7.png)
35
+ ![イメージ説明](26cb4c235e523642cd4bffcf59a1a5b7.png)
36
+
37
+ 追記3: ![![イメージ説明](617513aeed33816434aec50e5af57a5d.png)]
38
+
39
+ recordファイル、エラー内容
40
+
41
+ ![イメージ説明](3698f98bc92e26f70186d439fe7025b2.png)
42
+
43
+ replayファイル

5

画像の追加

2020/04/02 14:29

投稿

GuMasi
GuMasi

スコア73

title CHANGED
File without changes
body CHANGED
@@ -30,5 +30,6 @@
30
30
  ![コード、エラー](2071805f1e2b77a138103d54bf927b27.png)
31
31
 
32
32
  追記2:
33
+  .pyファイルに記録用のコードを記述し実行後
33
34
 
34
- ![![.pyファルに記録用のコドを記述し実行後](ffdcf2db2f147111de056a5910997b46.png)](f5d6582cd462befea4c69c251d095441.png)
35
+ ![イジ説明](26cb4c235e523642cd4bffcf59a1a5b7.png)

4

画像の追加

2020/03/29 05:37

投稿

GuMasi
GuMasi

スコア73

title CHANGED
File without changes
body CHANGED
@@ -27,4 +27,8 @@
27
27
  hideturtle()
28
28
  done()
29
29
  ```
30
- ![コード、エラー](2071805f1e2b77a138103d54bf927b27.png)
30
+ ![コード、エラー](2071805f1e2b77a138103d54bf927b27.png)
31
+
32
+ 追記2:
33
+
34
+ ![![.pyファイルに記録用のコードを記述し実行後](ffdcf2db2f147111de056a5910997b46.png)](f5d6582cd462befea4c69c251d095441.png)

3

文法の修正

2020/03/29 05:35

投稿

GuMasi
GuMasi

スコア73

title CHANGED
File without changes
body CHANGED
@@ -11,8 +11,7 @@
11
11
  penup()
12
12
  pensize(4)
13
13
 
14
- # XXX: キャンバスの絶対座標で記録されてるので、タートル中心の座標に修正(数値は適当)
15
- for line in stream:
14
+ for line in stream:
16
15
  action, *args = line.strip().split(" ")
17
16
  print(action, args)
18
17
  if action == "setpos":
@@ -27,5 +26,5 @@
27
26
 
28
27
  hideturtle()
29
28
  done()
30
-
29
+ ```
31
30
  ![コード、エラー](2071805f1e2b77a138103d54bf927b27.png)

2

文法の修正

2020/03/27 10:42

投稿

GuMasi
GuMasi

スコア73

title CHANGED
File without changes
body CHANGED
@@ -28,10 +28,4 @@
28
28
  hideturtle()
29
29
  done()
30
30
 
31
- ```txt
32
-
33
- ```
34
-
35
- ```
36
-
37
31
  ![コード、エラー](2071805f1e2b77a138103d54bf927b27.png)

1

ソースコード追加

2020/03/27 10:39

投稿

GuMasi
GuMasi

スコア73

title CHANGED
File without changes
body CHANGED
@@ -1,1 +1,37 @@
1
- タートルグラフィックスを用いて文字(名前:apple)を描画したいのですが可能でしょうか?
1
+ タートルグラフィックスを用いて文字(名前:apple)を描画したいのですが可能でしょうか?
2
+
3
+ 追記:
4
+
5
+ ```python
6
+ from turtle import *
7
+
8
+ with open("handwriting-apple.txt", encoding="utf-8") as stream:
9
+ write("Apple", None, "center", "serif 64 bold")
10
+ color("red")
11
+ penup()
12
+ pensize(4)
13
+
14
+ # XXX: キャンバスの絶対座標で記録されてるので、タートル中心の座標に修正(数値は適当)
15
+ for line in stream:
16
+ action, *args = line.strip().split(" ")
17
+ print(action, args)
18
+ if action == "setpos":
19
+ x, y = map(int, args)
20
+ setpos(x-480, -y+400)
21
+ elif action == "pendown":
22
+ x, y = map(int, args)
23
+ setpos(x-480, -y+400)
24
+ pendown()
25
+ elif action == "penup":
26
+ penup()
27
+
28
+ hideturtle()
29
+ done()
30
+
31
+ ```txt
32
+
33
+ ```
34
+
35
+ ```
36
+
37
+ ![コード、エラー](2071805f1e2b77a138103d54bf927b27.png)