質問編集履歴
1
コードを実行できるように修正。
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,11 +6,18 @@
|
|
6
6
|
|
7
7
|
### 現在のコード
|
8
8
|
```Python
|
9
|
+
#coding:utf-8
|
10
|
+
|
11
|
+
import tkinter as tk
|
12
|
+
from tkinter import ttk
|
13
|
+
|
14
|
+
root = tk.Tk()
|
15
|
+
|
9
16
|
x = 0.1
|
10
17
|
y = 0.2
|
11
18
|
|
12
19
|
for i in range(2):
|
13
|
-
box = ttk.Combobox(
|
20
|
+
box = ttk.Combobox(root, values=["A","B"])
|
14
21
|
box.place(relx=0.1, rely=y-0.1)
|
15
22
|
box.current(0)
|
16
23
|
box.bind("<<ComboboxSelected>>", lambda e: print(box.get()))
|
@@ -18,6 +25,8 @@
|
|
18
25
|
|
19
26
|
x += 0.1
|
20
27
|
y += 0.1
|
28
|
+
|
29
|
+
root.mainloop()
|
21
30
|
```
|
22
31
|
|
23
32
|
### 試したこと
|
@@ -27,14 +36,18 @@
|
|
27
36
|
|
28
37
|
|
29
38
|
```Python
|
39
|
+
import tkinter as tk
|
40
|
+
from tkinter import ttk
|
41
|
+
|
42
|
+
root = tk.Tk()
|
43
|
+
|
30
44
|
x = 0.1
|
31
45
|
y = 0.2
|
32
46
|
|
33
|
-
box = ttk.Combobox(
|
47
|
+
box = ttk.Combobox(root, values=["A","B"])
|
34
|
-
box2 = ttk.Combobox(
|
48
|
+
box2 = ttk.Combobox(root, values=["A","B"])
|
35
49
|
|
36
50
|
box_array = [box, box2]
|
37
|
-
|
38
51
|
for i in box_array:
|
39
52
|
i.place(relx=0.1, rely=y-0.1)
|
40
53
|
i.current(0)
|
@@ -43,6 +56,8 @@
|
|
43
56
|
x += 0.1
|
44
57
|
y += 0.1
|
45
58
|
|
59
|
+
root.mainloop()
|
60
|
+
|
46
61
|
```
|
47
62
|
### 動作環境
|
48
63
|
windows10
|