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

回答編集履歴

2

余分なコードを削除

2020/11/02 12:50

投稿

gottadiveintopy
gottadiveintopy

スコア736

answer CHANGED
@@ -13,7 +13,6 @@
13
13
  BoxLayout:
14
14
  size: root.size
15
15
  Label:
16
- id: label1
17
16
  font_size: 40
18
17
  text: app.shared_data.text
19
18
  Button:

1

sample codeの改善

2020/11/02 12:50

投稿

gottadiveintopy
gottadiveintopy

スコア736

answer CHANGED
@@ -12,29 +12,22 @@
12
12
  <MainScreen>:
13
13
  BoxLayout:
14
14
  size: root.size
15
-
16
15
  Label:
17
-
18
16
  id: label1
19
17
  font_size: 40
20
18
  text: app.shared_data.text
21
-
22
19
  Button:
23
20
  id: label_syokuhin
24
21
  font_size: 40
25
22
  text:'next'
26
-
27
23
  on_press:
28
24
  root.manager.transition.direction='left'
29
25
  root.manager.current = 'second'
30
26
 
31
27
 
32
28
  <SubScreen>:
33
- on_kv_post:
34
- text1.bind(text=app.shared_data.setter('text'))
35
29
  BoxLayout:
36
30
  orientation: 'vertical'
37
-
38
31
  BoxLayout:
39
32
  Button:
40
33
  text: 'back'
@@ -44,12 +37,11 @@
44
37
  root.manager.current = 'first'
45
38
 
46
39
  TextInput:
47
- id: text1
48
40
  font_size: 40
49
-
50
41
  line_height: 1
51
42
  multiline: False
52
43
  hint_text: 'input'
44
+ on_kv_post: self.bind(text=app.shared_data.setter('text'))
53
45
 
54
46
  ''')
55
47