質問編集履歴
3
コードを読めるように改造しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
+
```ここ```ここに言語を入力
|
2
|
+
|
3
|
+
コード
|
4
|
+
|
5
|
+
```
|
6
|
+
|
7
|
+
コード
|
8
|
+
|
1
|
-
```
|
9
|
+
```import tkinter as tk
|
2
10
|
|
3
11
|
import tkinter.filedialog as fd
|
4
12
|
|
@@ -42,10 +50,6 @@
|
|
42
50
|
|
43
51
|
tk.mainloop()に言語を入力
|
44
52
|
|
45
|
-
コード
|
46
|
-
|
47
|
-
```
|
48
|
-
|
49
53
|
|
50
54
|
|
51
55
|
```
|
2
コードを読めるように改造しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -48,46 +48,4 @@
|
|
48
48
|
|
49
49
|
|
50
50
|
|
51
|
-
```import tkinter as tk
|
52
|
-
|
53
|
-
import tkinter.filedialog as fd
|
54
|
-
|
55
|
-
import PIL.Image
|
56
|
-
|
57
|
-
import PIL.ImageTk
|
58
|
-
|
59
|
-
def dispPhoto(path):
|
60
|
-
|
61
|
-
newImage=PIL.Image.open(path).resiza((300,300))
|
62
|
-
|
63
|
-
imageData=PIL.ImageTk.PhotoImage(newImage)
|
64
|
-
|
65
|
-
imageLabel.configure(image=imagData)
|
66
|
-
|
67
|
-
imageLabel.image=imageData
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
def openFile():
|
72
|
-
|
73
|
-
fpath=fd.askopenfilename()
|
74
|
-
|
75
|
-
if fpath:
|
76
|
-
|
77
|
-
dispPhoto(fpath)
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
root=tk.Tk()
|
82
|
-
|
83
|
-
root.geometry("400x350")
|
84
|
-
|
85
|
-
btn=tk.Button(text="ファイルOPEN",command=openFile)
|
86
|
-
|
87
|
-
imageLabel=tk.Label()
|
88
|
-
|
89
|
-
|
51
|
+
```
|
90
|
-
|
91
|
-
imageLabel.pack()
|
92
|
-
|
93
|
-
tk.mainloop()
|
1
コードを読めるように改造しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,52 @@
|
|
1
|
+
```ここimport tkinter as tk
|
2
|
+
|
3
|
+
import tkinter.filedialog as fd
|
4
|
+
|
5
|
+
import PIL.Image
|
6
|
+
|
7
|
+
import PIL.ImageTk
|
8
|
+
|
9
|
+
def dispPhoto(path):
|
10
|
+
|
11
|
+
newImage=PIL.Image.open(path).resiza((300,300))
|
12
|
+
|
13
|
+
imageData=PIL.ImageTk.PhotoImage(newImage)
|
14
|
+
|
15
|
+
imageLabel.configure(image=imagData)
|
16
|
+
|
17
|
+
imageLabel.image=imageData
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
def openFile():
|
22
|
+
|
23
|
+
fpath=fd.askopenfilename()
|
24
|
+
|
25
|
+
if fpath:
|
26
|
+
|
27
|
+
dispPhoto(fpath)
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
root=tk.Tk()
|
32
|
+
|
33
|
+
root.geometry("400x350")
|
34
|
+
|
35
|
+
btn=tk.Button(text="ファイルOPEN",command=openFile)
|
36
|
+
|
37
|
+
imageLabel=tk.Label()
|
38
|
+
|
39
|
+
btn.pack
|
40
|
+
|
41
|
+
imageLabel.pack()
|
42
|
+
|
1
|
-
|
43
|
+
tk.mainloop()に言語を入力
|
2
44
|
|
3
45
|
コード
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
|
4
50
|
|
5
51
|
```import tkinter as tk
|
6
52
|
|