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

質問編集履歴

3

文法の修正、訂正

2020/07/15 09:18

投稿

nekodoro
nekodoro

スコア2

title CHANGED
File without changes
body CHANGED
@@ -4,15 +4,14 @@
4
4
  これを応用してどのようにすればできるでしょうか
5
5
  グリッド線を下から上へ行くような円のアニメーションがいいです。
6
6
 
7
- BitAllowというサイトでプログラミングを行っているのですが、
7
+ BitArrowというサイトでプログラミングを行っているのですが、
8
8
  そこのpythonのグラフィックスライブラリがimport gとなっています。
9
- BitAllow pythonと検索すれば出てくると思います。
9
+ BitArrow pythonと検索すれば出てくると思います。
10
10
 
11
11
  インデントの修正をしました。
12
12
 
13
13
  ```python
14
14
  import g
15
-
16
15
  class Point:
17
16
  def __init__(self,x,y):
18
17
  self.x=x
@@ -24,7 +23,6 @@
24
23
  self.y+=dy
25
24
  def draw(self):
26
25
  g.fillOval(self.x-5, self.y-5,10,10)
27
-
28
26
  class Shape:
29
27
  def move(self,dx,dy):
30
28
  self.o.move(dx,dy)
@@ -35,54 +33,19 @@
35
33
  self.height=height
36
34
  def draw(self):
37
35
  g.fillRect(self.o.x, self.o.y, self.width, self.height)
38
-
39
36
  g.drawGrid()
40
-
41
37
  def move():
42
38
  global r1
39
+ global r2
43
40
  g.clear()
44
41
  r1.draw()
42
+ r2.draw()
45
43
  r1.move(10,10)
44
+ r2.move(0,-10)
46
45
  g.setTimeout(move,100)
47
46
  r1=Rectangle(Point(20,50),50,50)
47
+ r2=Rectangle(Point(120,150),50,50)
48
48
  move()
49
-
50
49
  g.wait()
51
- ```
52
- import g
53
50
 
54
- class Point:
55
- def __init__(self,x,y):
56
- self.x=x
57
- self.y=y
58
- def __str__(self):
59
- return "Point({},{})".format(self.x,self.y)
60
- def move(self, dx,dy):
61
- self.x+=dx
62
- self.y+=dy
63
- def draw(self):
64
- g.fillOval(self.x-5, self.y-5,10,10)
65
-
66
- class Shape:
67
- def move(self,dx,dy):
68
- self.o.move(dx,dy)
69
- class Rectangle(Shape):
70
- def __init__(self, o, width, height):
71
- self.o=o
72
- self.width=width
73
- self.height=height
74
- def draw(self):
75
- g.fillRect(self.o.x, self.o.y, self.width, self.height)
76
-
77
- g.drawGrid()
78
-
79
- def move():
80
- global r1
81
- g.clear()
82
- r1.draw()
83
- r1.move(10,10)
84
- g.setTimeout(move,100)
85
- r1=Rectangle(Point(20,50),50,50)
86
- move()
51
+ ```
87
-
88
- g.wait()

2

サイトの付け加え

2020/07/15 09:18

投稿

nekodoro
nekodoro

スコア2

title CHANGED
File without changes
body CHANGED
@@ -4,6 +4,12 @@
4
4
  これを応用してどのようにすればできるでしょうか
5
5
  グリッド線を下から上へ行くような円のアニメーションがいいです。
6
6
 
7
+ BitAllowというサイトでプログラミングを行っているのですが、
8
+ そこのpythonのグラフィックスライブラリがimport gとなっています。
9
+ BitAllow pythonと検索すれば出てくると思います。
10
+
11
+ インデントの修正をしました。
12
+
7
13
  ```python
8
14
  import g
9
15
 

1

インデントの修正

2020/07/15 08:30

投稿

nekodoro
nekodoro

スコア2

title CHANGED
File without changes
body CHANGED
@@ -4,7 +4,45 @@
4
4
  これを応用してどのようにすればできるでしょうか
5
5
  グリッド線を下から上へ行くような円のアニメーションがいいです。
6
6
 
7
+ ```python
8
+ import g
7
9
 
10
+ class Point:
11
+ def __init__(self,x,y):
12
+ self.x=x
13
+ self.y=y
14
+ def __str__(self):
15
+ return "Point({},{})".format(self.x,self.y)
16
+ def move(self, dx,dy):
17
+ self.x+=dx
18
+ self.y+=dy
19
+ def draw(self):
20
+ g.fillOval(self.x-5, self.y-5,10,10)
21
+
22
+ class Shape:
23
+ def move(self,dx,dy):
24
+ self.o.move(dx,dy)
25
+ class Rectangle(Shape):
26
+ def __init__(self, o, width, height):
27
+ self.o=o
28
+ self.width=width
29
+ self.height=height
30
+ def draw(self):
31
+ g.fillRect(self.o.x, self.o.y, self.width, self.height)
32
+
33
+ g.drawGrid()
34
+
35
+ def move():
36
+ global r1
37
+ g.clear()
38
+ r1.draw()
39
+ r1.move(10,10)
40
+ g.setTimeout(move,100)
41
+ r1=Rectangle(Point(20,50),50,50)
42
+ move()
43
+
44
+ g.wait()
45
+ ```
8
46
  import g
9
47
 
10
48
  class Point: