質問編集履歴
7
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -45,39 +45,8 @@
|
|
45
45
|
```
|
46
46
|
|
47
47
|
### 該当のソースコード
|
48
|
-
import tkinter as tk
|
49
|
-
import tkinter.filedialog as fd
|
50
|
-
import PIL.Image
|
51
|
-
import PIL.ImageTk
|
52
48
|
|
53
|
-
def dispPhoto(path):
|
54
|
-
|
55
|
-
newImage = PIL.Image.open(path).resize((300,300))
|
56
|
-
|
57
|
-
imageData = PIL.ImageTk.Photomage(newImage)
|
58
|
-
imageLabel.configure(image = imageData)
|
59
|
-
imageLabel.image=imageData
|
60
49
|
|
61
|
-
def openFile():
|
62
|
-
fpath = fd.askopenfilename()
|
63
|
-
|
64
|
-
if fpath:
|
65
|
-
dispPhoto(fpath)
|
66
|
-
|
67
|
-
root=tk.Tk()
|
68
|
-
root.geometry("400x350")
|
69
|
-
|
70
|
-
btn=tk.Button(text="ファイルを開く",command = openFile)
|
71
|
-
imageLabel = tk.Label()
|
72
|
-
btn.pack()
|
73
|
-
imageLabel.pack()
|
74
|
-
tk.mainloop()
|
75
|
-
|
76
|
-
|
77
|
-
```ここに言語名を入力
|
78
|
-
ソースコード
|
79
|
-
```
|
80
|
-
|
81
50
|
### 試したこと
|
82
51
|
|
83
52
|
pillowはインストールしました。
|
6
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -28,9 +28,6 @@
|
|
28
28
|
tk.mainloop()
|
29
29
|
```
|
30
30
|
|
31
|
-
```ここに質問の内容を詳しく書いてください。
|
32
|
-
(例)PHP(CakePHP)で●●なシステムを作っています。
|
33
|
-
■■な機能を実装中に以下のエラーメッセージが発生しました。
|
34
31
|
|
35
32
|
### 発生している問題・エラーメッセージ
|
36
33
|
pythonを本で勉強している初心者なのですが、本のコードを入力してもエラーが出てしまいます。いろいろ試したのですがわからないので教えてほしいです。
|
5
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
+
```python
|
1
|
-
|
2
|
+
import tkinter as tk
|
2
3
|
import tkinter.filedialog as fd
|
3
4
|
import PIL.Image
|
4
5
|
import PIL.ImageTk
|
@@ -25,6 +26,8 @@
|
|
25
26
|
btn.pack()
|
26
27
|
imageLabel.pack()
|
27
28
|
tk.mainloop()
|
29
|
+
```
|
30
|
+
|
28
31
|
```ここに質問の内容を詳しく書いてください。
|
29
32
|
(例)PHP(CakePHP)で●●なシステムを作っています。
|
30
33
|
■■な機能を実装中に以下のエラーメッセージが発生しました。
|
4
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -24,8 +24,7 @@
|
|
24
24
|
imageLabel = tk.Label()
|
25
25
|
btn.pack()
|
26
26
|
imageLabel.pack()
|
27
|
-
tk.mainloop()
|
27
|
+
tk.mainloop()
|
28
|
-
コード
|
29
28
|
```ここに質問の内容を詳しく書いてください。
|
30
29
|
(例)PHP(CakePHP)で●●なシステムを作っています。
|
31
30
|
■■な機能を実装中に以下のエラーメッセージが発生しました。
|
3
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,30 @@
|
|
1
|
+
```import tkinter as tk
|
2
|
+
import tkinter.filedialog as fd
|
3
|
+
import PIL.Image
|
4
|
+
import PIL.ImageTk
|
5
|
+
|
6
|
+
def dispPhoto(path):
|
7
|
+
|
8
|
+
newImage = PIL.Image.open(path).resize((300,300))
|
9
|
+
|
10
|
+
imageData = PIL.ImageTk.Photomage(newImage)
|
11
|
+
imageLabel.configure(image = imageData)
|
12
|
+
imageLabel.image=imageData
|
13
|
+
|
14
|
+
def openFile():
|
15
|
+
fpath = fd.askopenfilename()
|
16
|
+
|
17
|
+
if fpath:
|
18
|
+
dispPhoto(fpath)
|
19
|
+
|
20
|
+
root=tk.Tk()
|
21
|
+
root.geometry("400x350")
|
22
|
+
|
23
|
+
btn=tk.Button(text="ファイルを開く",command = openFile)
|
24
|
+
imageLabel = tk.Label()
|
25
|
+
btn.pack()
|
26
|
+
imageLabel.pack()
|
1
|
-
|
27
|
+
tk.mainloop()ここに言語を入力
|
2
28
|
コード
|
3
29
|
```ここに質問の内容を詳しく書いてください。
|
4
30
|
(例)PHP(CakePHP)で●●なシステムを作っています。
|
2
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
```ここに言語を入力
|
2
|
-
|
2
|
+
コード
|
3
|
-
ここに質問の内容を詳しく書いてください。
|
3
|
+
```ここに質問の内容を詳しく書いてください。
|
4
4
|
(例)PHP(CakePHP)で●●なシステムを作っています。
|
5
5
|
■■な機能を実装中に以下のエラーメッセージが発生しました。
|
6
6
|
|
1
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -26,13 +26,13 @@
|
|
26
26
|
import PIL.ImageTk
|
27
27
|
|
28
28
|
def dispPhoto(path):
|
29
|
-
|
29
|
+
|
30
30
|
newImage = PIL.Image.open(path).resize((300,300))
|
31
|
-
|
31
|
+
|
32
|
-
imageData = PIL.ImageTk.
|
32
|
+
imageData = PIL.ImageTk.Photomage(newImage)
|
33
33
|
imageLabel.configure(image = imageData)
|
34
34
|
imageLabel.image=imageData
|
35
|
-
|
35
|
+
|
36
36
|
def openFile():
|
37
37
|
fpath = fd.askopenfilename()
|
38
38
|
|