質問編集履歴
1
修正後、(コメントアウトを元に戻しましたが)今度は別のエラーが出ます
test
CHANGED
File without changes
|
test
CHANGED
@@ -112,4 +112,112 @@
|
|
112
112
|
|
113
113
|
|
114
114
|
|
115
|
+
|
116
|
+
|
117
|
+
-------------------------
|
118
|
+
|
119
|
+
修正→ファイル名の拡張子の前のピリオドを入れた
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
import tkinter
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
#ウィンドウ作成
|
128
|
+
|
129
|
+
root=tkinter.Tk()
|
130
|
+
|
131
|
+
root.title("勇者求む")
|
132
|
+
|
133
|
+
root.minsize(640,480)
|
134
|
+
|
135
|
+
root.option_add("*font",["メイリオ",14])
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
#画像読み込み
|
140
|
+
|
141
|
+
img1=tkinter.PhotoImage(file = 'C:/python/img4/chap4-1-1.png')
|
142
|
+
|
143
|
+
img2=tkinter.PhotoImage(file= 'C:/python/img4/chap4-1-2.png')
|
144
|
+
|
145
|
+
img3=tkinter.PhotoImage(file= 'C:/Python/img4/chap4-1-3.png')
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
#キャンバス作成
|
150
|
+
|
151
|
+
canvas=tkinter.Canvas(root,width=640,height=480)
|
152
|
+
|
153
|
+
canvas.place(x=0,y=0)
|
154
|
+
|
155
|
+
canvas.create_image(320,220,image=img1,tag="illust")
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
#ラベル配置
|
160
|
+
|
161
|
+
serihu_text=tkinter.Label(text=\
|
162
|
+
|
163
|
+
"王様「魔王を倒したら褒美をやるぞ」")
|
164
|
+
|
165
|
+
serihu_text.place(x=160,y=10)
|
166
|
+
|
167
|
+
sys_text=tkinter.Label(text="褒美はいくら上げますか",fg="red")
|
168
|
+
|
169
|
+
sys_text.place(x=180,y=380)
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
#入力ボックス配置
|
174
|
+
|
175
|
+
entry=tkinter.Entry(width=12)
|
176
|
+
|
177
|
+
entry.place(x=180,y=360)
|
178
|
+
|
179
|
+
gold_text=tkinter.Label(text="ゴールド")
|
180
|
+
|
181
|
+
gold_text.place(x=330,y=420)
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
#ボタン配置
|
186
|
+
|
187
|
+
button=tkinter.Button(text="決定")
|
188
|
+
|
189
|
+
button.place(x=420,y=420)
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
root.meinloop()
|
194
|
+
|
195
|
+
-------------------
|
196
|
+
|
197
|
+
(エラー内容)
|
198
|
+
|
199
|
+
PS C:\python> python chap2.py
|
200
|
+
|
201
|
+
Traceback (most recent call last):
|
202
|
+
|
203
|
+
File "C:\python\chap2.py", line 36, in <module>
|
204
|
+
|
205
|
+
root.meinloop()
|
206
|
+
|
207
|
+
File "C:\Users\admin\AppData\Local\Programs\Python\Python39\lib\tkinter\__init__.py", line 2346, in __getattr__
|
208
|
+
|
209
|
+
return getattr(self.tk, attr)
|
210
|
+
|
211
|
+
AttributeError: '_tkinter.tkapp' object has no attribute 'meinloop'
|
212
|
+
|
213
|
+
PS C:\python>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
115
219
|
```
|
220
|
+
|
221
|
+
今度は、上記のようなエラーがでます。
|
222
|
+
|
223
|
+
これはどんなことが原因と考えられますでしょうか。
|