回答編集履歴

1

コード中の不適切な部分を修正

2020/01/28 19:15

投稿

dodox86
dodox86

スコア9183

test CHANGED
@@ -130,7 +130,7 @@
130
130
 
131
131
  for child in children:
132
132
 
133
- # print("type of widget is : " + str(type(child)))
133
+ print("type of widget is : " + str(type(child)))
134
134
 
135
135
  if str(type(child)) == "<class 'tkinter.Radiobutton'>":
136
136
 
@@ -190,21 +190,17 @@
190
190
 
191
191
  icon = ImageTk.PhotoImage(resize_img)
192
192
 
193
- if icon_label is None:
194
-
195
- # ラベル未生成の場合のみ、生成する。
196
-
197
- icon_label = ttk.Label(tki, compound="top")
193
+ label = tkinter.Label(tki, compound="top")
198
-
194
+
199
- icon_label.place(x=10, y=240)
195
+ label.place(x=10, y=240)
200
196
 
201
197
 
202
198
 
203
199
  # 動的に画像とテキストをセット
204
200
 
205
- icon_label.configure(image=icon, text="アイコンラベル: " + fname)
201
+ label.configure(image=icon, text="アイコンラベル: " + fname)
206
-
202
+
207
- icon_label.image = icon
203
+ label.image = icon
208
204
 
209
205
 
210
206
 
@@ -268,6 +264,10 @@
268
264
 
269
265
  root.mainloop()
270
266
 
267
+
268
+
269
+
270
+
271
271
  ```
272
272
 
273
273
  Python 3.8 32ビット版 + Pillow 7.0.0で、Windows 10(64ビット)上にて確認しました。