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

質問編集履歴

6

コードの編集

2020/10/27 11:02

投稿

hima-mura.
hima-mura.

スコア42

title CHANGED
File without changes
body CHANGED
@@ -49,7 +49,6 @@
49
49
  text:'Button'
50
50
  <MakeButton>:
51
51
  text:'Success'
52
- '''
53
52
  以下変更後のコードを追記します。(ちゃんと動きます。)
54
53
  from kivy.app import App
55
54
  from kivy.uix.floatlayout import FloatLayout
@@ -91,4 +90,5 @@
91
90
  size_hint:[0.2,0.2]
92
91
  <MakeButton>:
93
92
  text:'Success'
94
- size_hint:[0.2,0.2]
93
+ size_hint:[0.2,0.2]
94
+ ```

5

コードの編集

2020/10/27 11:02

投稿

hima-mura.
hima-mura.

スコア42

title CHANGED
File without changes
body CHANGED
@@ -49,6 +49,7 @@
49
49
  text:'Button'
50
50
  <MakeButton>:
51
51
  text:'Success'
52
+ '''
52
53
  以下変更後のコードを追記します。(ちゃんと動きます。)
53
54
  from kivy.app import App
54
55
  from kivy.uix.floatlayout import FloatLayout
@@ -90,5 +91,4 @@
90
91
  size_hint:[0.2,0.2]
91
92
  <MakeButton>:
92
93
  text:'Success'
93
- size_hint:[0.2,0.2]
94
+ size_hint:[0.2,0.2]
94
- '''

4

コードの編集

2020/10/27 11:01

投稿

hima-mura.
hima-mura.

スコア42

title CHANGED
File without changes
body CHANGED
@@ -49,8 +49,6 @@
49
49
  text:'Button'
50
50
  <MakeButton>:
51
51
  text:'Success'
52
- ```
53
-
54
52
  以下変更後のコードを追記します。(ちゃんと動きます。)
55
53
  from kivy.app import App
56
54
  from kivy.uix.floatlayout import FloatLayout
@@ -92,4 +90,5 @@
92
90
  size_hint:[0.2,0.2]
93
91
  <MakeButton>:
94
92
  text:'Success'
95
- size_hint:[0.2,0.2]
93
+ size_hint:[0.2,0.2]
94
+ '''

3

コードの編集

2020/10/27 11:00

投稿

hima-mura.
hima-mura.

スコア42

title CHANGED
File without changes
body CHANGED
@@ -49,4 +49,47 @@
49
49
  text:'Button'
50
50
  <MakeButton>:
51
51
  text:'Success'
52
- ```
52
+ ```
53
+
54
+ 以下変更後のコードを追記します。(ちゃんと動きます。)
55
+ from kivy.app import App
56
+ from kivy.uix.floatlayout import FloatLayout
57
+ from kivy.uix.label import Label
58
+ from kivy.uix.button import Button
59
+
60
+ class MyLayout(FloatLayout):
61
+ def on_touch_down(self,touch):
62
+ make_button=MakeButton()
63
+ self.add_widget(make_button)
64
+ make_button.pos=touch.pos
65
+
66
+ class MyLabel(Label):
67
+ pass
68
+
69
+ class MyButton(Button):
70
+ pass
71
+
72
+ class MakeButton(Button):
73
+ pass
74
+
75
+ class TameshiApp(App):
76
+ def build(self):
77
+ layout=MyLayout()
78
+ myl=MyLabel()
79
+ myb=MyButton()
80
+ layout.add_widget(myl)
81
+ layout.add_widget(myb)
82
+ return layout
83
+
84
+ TameshiApp().run()
85
+ -----------
86
+ <MyLabel>:
87
+ text:'Label'
88
+ pos:100,100
89
+ <MyButton>:
90
+ text:'Button'
91
+ pos:200,200
92
+ size_hint:[0.2,0.2]
93
+ <MakeButton>:
94
+ text:'Success'
95
+ size_hint:[0.2,0.2]

2

コードの編集

2020/10/27 10:59

投稿

hima-mura.
hima-mura.

スコア42

title CHANGED
File without changes
body CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  class MakeButton(Button,MyWidget):
27
27
  def __init__(self,*kwargs):
28
- super(MyLabel,self).__init__(*kwargs)
28
+ super(MakeButton,self).__init__(*kwargs)
29
29
  self.x=None #?????????
30
30
  self.y=None #?????????
31
31
 

1

コードの編集

2020/10/22 14:40

投稿

hima-mura.
hima-mura.

スコア42

title CHANGED
File without changes
body CHANGED
@@ -18,16 +18,16 @@
18
18
  pass
19
19
 
20
20
  class MyLabel(Label,MyWidget):
21
- def __init__(self,*kwargs):
22
- super(MyLabel,self).__init__(*kwargs)
21
+ pass
23
- self.x=None #?????????
24
- self.y=None #?????????
25
22
 
26
23
  class MyButton(Button,MyWidget):
27
24
  pass
28
25
 
29
26
  class MakeButton(Button,MyWidget):
27
+ def __init__(self,*kwargs):
30
- pass
28
+ super(MyLabel,self).__init__(*kwargs)
29
+ self.x=None #?????????
30
+ self.y=None #?????????
31
31
 
32
32
  class P34App(App):
33
33
  def build(self):