回答編集履歴
3
誤回答につき削除申請中。
test
CHANGED
@@ -1,55 +1 @@
|
|
1
|
-
Python の import 文の書式は次のようなものです。
|
2
|
-
|
3
|
-
```python
|
4
|
-
|
5
|
-
|
1
|
+
誤回答につき削除申請中。
|
6
|
-
|
7
|
-
from ライブラリの名前 import クラスの名前
|
8
|
-
|
9
|
-
from ライブラリの名前 import 関数の名前
|
10
|
-
|
11
|
-
```
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
そのため import 文を次のように書き換えてください。
|
16
|
-
|
17
|
-
```python
|
18
|
-
|
19
|
-
# 誤
|
20
|
-
|
21
|
-
import Tkinter as tkinter
|
22
|
-
|
23
|
-
from Tkinter import ttk
|
24
|
-
|
25
|
-
```
|
26
|
-
|
27
|
-
```python
|
28
|
-
|
29
|
-
# 正
|
30
|
-
|
31
|
-
from tkinter import Tk
|
32
|
-
|
33
|
-
from tkinter import ttk
|
34
|
-
|
35
|
-
```
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
[tkinter](https://docs.python.org/ja/3/library/tkinter.ttk.html) はライブラリの名前、Tkinter は tkinter というライブラリの配下のクラスの名前、 Tk は tkinter というライブラリの配下の関数の名前です。
|
40
|
-
|
41
|
-
* [Python の import 文ってなに?](https://python.ms/import/)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
---
|
46
|
-
|
47
|
-
以下、流し読みしてください。
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
この場合の理解のポイントは from するとスクリプトが実行されるということです。このとき、実行されるスクリプトは [ttk.py](https://docs.python.org/ja/3/library/tkinter.ttk.html) になります。すると ttk.py のグローバル変数を import することができます。グローバル変数を理解するには、スコープを理解する必要があります。
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
* [Python のスコープってなに?](https://python.ms/scope/)
|
2
誤字修正
test
CHANGED
@@ -38,6 +38,18 @@
|
|
38
38
|
|
39
39
|
[tkinter](https://docs.python.org/ja/3/library/tkinter.ttk.html) はライブラリの名前、Tkinter は tkinter というライブラリの配下のクラスの名前、 Tk は tkinter というライブラリの配下の関数の名前です。
|
40
40
|
|
41
|
+
* [Python の import 文ってなに?](https://python.ms/import/)
|
41
42
|
|
42
43
|
|
44
|
+
|
45
|
+
---
|
46
|
+
|
47
|
+
以下、流し読みしてください。
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
この場合の理解のポイントは from するとスクリプトが実行されるということです。このとき、実行されるスクリプトは [ttk.py](https://docs.python.org/ja/3/library/tkinter.ttk.html) になります。すると ttk.py のグローバル変数を import することができます。グローバル変数を理解するには、スコープを理解する必要があります。
|
52
|
+
|
53
|
+
|
54
|
+
|
43
|
-
* [Python の
|
55
|
+
* [Python のスコープってなに?](https://python.ms/scope/)
|
1
誤字修正
test
CHANGED
@@ -36,4 +36,8 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
+
[tkinter](https://docs.python.org/ja/3/library/tkinter.ttk.html) はライブラリの名前、Tkinter は tkinter というライブラリの配下のクラスの名前、 Tk は tkinter というライブラリの配下の関数の名前です。
|
40
|
+
|
41
|
+
|
42
|
+
|
39
43
|
* [Python の import 文ってなに?](https://python.ms/import/)
|