質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -1 +1,49 @@
|
|
1
1
|
KivyのButtonクラスにtextを入れ、Buttonをクリックしたときにクリックしたボタンのtextをpython側で取得するためにはどのように書くのがよいのでしょうか?
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
私が試したコードを記載します。
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
```pyhton
|
10
|
+
|
11
|
+
class Test(BoxLayout):
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
def Searching(self):
|
16
|
+
|
17
|
+
print(self.text)
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
```
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
```
|
26
|
+
|
27
|
+
<Test>:
|
28
|
+
|
29
|
+
Button:
|
30
|
+
|
31
|
+
text: "Egg"
|
32
|
+
|
33
|
+
on_press: root.Searching()
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
Button:
|
38
|
+
|
39
|
+
text: "Egg market"
|
40
|
+
|
41
|
+
on_press: root.Searching()
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
```
|