質問編集履歴
2
コードの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -31,7 +31,9 @@
|
|
31
31
|
btn1.configure(text="test", command=func.img_open)
|
32
32
|
btn1.pack(anchor="ne")
|
33
33
|
|
34
|
+
root.mainloop()
|
34
35
|
|
36
|
+
|
35
37
|
def img_open():
|
36
38
|
img1 = cv2.imread('1.png')
|
37
39
|
img2 = cv2.imread('2.png')
|
1
コードの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,4 +9,38 @@
|
|
9
9
|
以前MACの環境で実行した際は,tkinterの画面を閉じることなく,plt.showの画面を閉じることで続きの処理が実行されていたので,非常に困っています
|
10
10
|
|
11
11
|
改善方法などありますでしょうか.
|
12
|
-
よろしくお願いします.
|
12
|
+
よろしくお願いします.
|
13
|
+
|
14
|
+
|
15
|
+
```ここに言語を入力
|
16
|
+
|
17
|
+
from PIL import Image, ImageTk
|
18
|
+
import numpy as np
|
19
|
+
import tkinter as tk
|
20
|
+
import tkinter.ttk as ttk
|
21
|
+
import tkinter.filedialog as tkfd
|
22
|
+
import cv2
|
23
|
+
|
24
|
+
|
25
|
+
if __name__ == "__main__":
|
26
|
+
|
27
|
+
root = tk.Tk()
|
28
|
+
root.title("")
|
29
|
+
root.geometry("")
|
30
|
+
btn1 = tk.Button(root)
|
31
|
+
btn1.configure(text="test", command=func.img_open)
|
32
|
+
btn1.pack(anchor="ne")
|
33
|
+
|
34
|
+
|
35
|
+
def img_open():
|
36
|
+
img1 = cv2.imread('1.png')
|
37
|
+
img2 = cv2.imread('2.png')
|
38
|
+
img3 = cv2.imread('3.png')
|
39
|
+
plt.imshow(img1)
|
40
|
+
plt.show()
|
41
|
+
plt.imshow(img2) #以降の処理がメインウィンドウを閉じてから実行される
|
42
|
+
plt.show()
|
43
|
+
plt.imshow(img3)
|
44
|
+
plt.show()
|
45
|
+
|
46
|
+
```
|