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

回答編集履歴

2

実行結果を追記

2017/11/17 09:39

投稿

8524ba23
8524ba23

スコア38352

answer CHANGED
@@ -36,4 +36,36 @@
36
36
  else:
37
37
  if input('input 9 to exit:') == 9:
38
38
  break
39
+ ```
40
+
41
+ 実行結果。Win10x64上。
42
+ ```
43
+ >python hoge.py
44
+ [INFO ] [Logger ] Record log in C:\Users\user.kivy\logs\kivy_17-11-17_29.txt
45
+ [INFO ] [Kivy ] v1.10.0
46
+ [INFO ] [Python ] v2.7.14 |Anaconda custom (64-bit)| (default, Nov 8 2017, 13:40:45) [MSC v.1500 64 bit (AMD64)]
47
+ [INFO ] [Factory ] 194 symbols loaded
48
+ [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
49
+ [INFO ] [OSC ] using <thread> for socket
50
+ [INFO ] [Window ] Provider: sdl2
51
+ [INFO ] [GL ] Using the "OpenGL" graphics system
52
+ [INFO ] [GL ] GLEW initialization succeeded
53
+ [INFO ] [GL ] Backend used <glew>
54
+ [INFO ] [GL ] OpenGL version <4.0.0 - Build 10.18.10.4425>
55
+ [INFO ] [GL ] OpenGL vendor <Intel>
56
+ [INFO ] [GL ] OpenGL renderer <Intel(R) HD Graphics 4000>
57
+ [INFO ] [GL ] OpenGL parsed version: 4, 0
58
+ [INFO ] [GL ] Shading version <4.00 - Build 10.18.10.4425>
59
+ [INFO ] [GL ] Texture max size <16384>
60
+ [INFO ] [GL ] Texture max units <16>
61
+ [INFO ] [Window ] auto add sdl2 input provider
62
+ [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
63
+ [INFO ] [Text ] Provider: sdl2
64
+ [INFO ] [Base ] Start application main loop
65
+ [INFO ] [GL ] NPOT texture support is available
66
+ [ERROR ] [Base ] No event listeners have been created
67
+ [ERROR ] [Base ] Application will leave
68
+ input 9 to exit:1
69
+ input 9 to exit:9
70
+ >
39
71
  ```

1

検証コードを追加

2017/11/17 09:38

投稿

8524ba23
8524ba23

スコア38352

answer CHANGED
@@ -3,4 +3,37 @@
3
3
  Builder.load_string("""
4
4
  # 略
5
5
  on_press: app.root_window.close()
6
+ ```
7
+
8
+ 以下検証コードです。
9
+ ```
10
+ from kivy.lang import Builder
11
+ from kivy.app import App
12
+ from kivy.uix.boxlayout import BoxLayout
13
+
14
+ Builder.load_string("""
15
+ <MyApp>:
16
+ Button:
17
+ id: btn
18
+ font_size: 68
19
+ Button:
20
+ id: btnExit
21
+ text: "Exit"
22
+ on_press: app.root_window.close()
23
+ """)
24
+
25
+ class MyApp(App, BoxLayout):
26
+ def build(self):
27
+ self.ids.btn.text = 'by Python'
28
+ return self
29
+
30
+ if __name__ == "__main__":
31
+ bApp = False
32
+ while True:
33
+ if bApp is False:
34
+ MyApp().run()
35
+ bApp = True
36
+ else:
37
+ if input('input 9 to exit:') == 9:
38
+ break
6
39
  ```