質問編集履歴

3

修正

2021/07/08 05:58

投稿

person
person

スコア224

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  ループでfocus_get()と一致するエントリを割り出してから該当のsvを指定するやり方ならできるのですが、
46
46
 
47
- Entryウィジェットからsv1やsv2を得ることは可能ですか?
47
+ Entryのインスンタンスentry1、entry2からsv1やsv2を得ることは可能ですか?
48
48
 
49
49
 
50
50
 

2

追加

2021/07/08 05:58

投稿

person
person

スコア224

test CHANGED
File without changes
test CHANGED
@@ -9,6 +9,34 @@
9
9
 
10
10
 
11
11
  ただ、フォーカスがあたっているエントリに設定されているStringVar()の取得ができず、上記の処理ができません。
12
+
13
+
14
+
15
+ ```
16
+
17
+ focused_widget["textvariable"].set("")
18
+
19
+
20
+
21
+ # Attribute Error: 'str' object has no attribute 'set'
22
+
23
+ ```
24
+
25
+
26
+
27
+ ```
28
+
29
+ focused_widget["textvariable"].widget.set("")
30
+
31
+
32
+
33
+ # Attribute Error: 'str' object has no attribute 'widget'
34
+
35
+ ```
36
+
37
+
38
+
39
+ などを試しましたができませんでした。
12
40
 
13
41
 
14
42
 

1

修正

2021/07/08 05:55

投稿

person
person

スコア224

test CHANGED
File without changes
test CHANGED
@@ -50,11 +50,11 @@
50
50
 
51
51
 
52
52
 
53
- entry1 = tk.Entry(win)
53
+ entry1 = tk.Entry(win, textvariable=sv1)
54
54
 
55
55
  entry1.grid()
56
56
 
57
- entry2 = tk.Entry(win)
57
+ entry2 = tk.Entry(win, textvariable=sv2)
58
58
 
59
59
  entry2.grid()
60
60