質問編集履歴
1
コードの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -155,3 +155,169 @@
|
|
155
155
|
グローバル変数を使用しない方法でお願いします。
|
156
156
|
|
157
157
|
(Windows10,Python 3.7.3)
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
【追記】
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
●list1
|
166
|
+
|
167
|
+
```Python
|
168
|
+
|
169
|
+
import tkinter
|
170
|
+
|
171
|
+
import win32api
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
def pushed1():
|
176
|
+
|
177
|
+
root1.destroy()
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
def pushed2():
|
182
|
+
|
183
|
+
root2.destroy()
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
#メイン処理
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
# 1) 開始処理
|
192
|
+
|
193
|
+
root1=tkinter.Tk()
|
194
|
+
|
195
|
+
root1.title('開始')
|
196
|
+
|
197
|
+
root1.geometry('300x200')
|
198
|
+
|
199
|
+
label1=tkinter.Label(root1,text='実行を開始します')
|
200
|
+
|
201
|
+
label1.grid()
|
202
|
+
|
203
|
+
button1=tkinter.Button(root1,text='開始',command=lambda : pushed1())
|
204
|
+
|
205
|
+
button1.grid()
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
root1.mainloop()
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
# 2) 本処理
|
214
|
+
|
215
|
+
win32api.Sleep(10000)
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
# 3) 終了処理
|
220
|
+
|
221
|
+
root2=tkinter.Tk()
|
222
|
+
|
223
|
+
root2.title('終了')
|
224
|
+
|
225
|
+
root2.geometry('300x200')
|
226
|
+
|
227
|
+
label2=tkinter.Label(root2,text='終了しました')
|
228
|
+
|
229
|
+
label2.grid()
|
230
|
+
|
231
|
+
button2=tkinter.Button(root2,text='完了',command=lambda : pushed2())
|
232
|
+
|
233
|
+
button2.grid()
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
root2.mainloop()
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
print('END')
|
242
|
+
|
243
|
+
```
|
244
|
+
|
245
|
+
●list2
|
246
|
+
|
247
|
+
```Python
|
248
|
+
|
249
|
+
import tkinter
|
250
|
+
|
251
|
+
import win32api
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
def pushed1():
|
256
|
+
|
257
|
+
root1.destroy()
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
def pushed2():
|
262
|
+
|
263
|
+
root2.destroy()
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
#メイン処理
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
# 1) 開始処理
|
272
|
+
|
273
|
+
root1=tkinter.Tk()
|
274
|
+
|
275
|
+
root1.title('開始')
|
276
|
+
|
277
|
+
root1.geometry('300x200')
|
278
|
+
|
279
|
+
label1=tkinter.Label(root1,text='実行を開始します')
|
280
|
+
|
281
|
+
label1.grid()
|
282
|
+
|
283
|
+
button1=tkinter.Button(root1,text='開始',command=lambda : pushed1())
|
284
|
+
|
285
|
+
button1.grid()
|
286
|
+
|
287
|
+
root1.grab_set()
|
288
|
+
|
289
|
+
root1.wait_window(root1)
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
# 2) 本処理
|
294
|
+
|
295
|
+
win32api.Sleep(10000)
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
# 3) 終了処理
|
300
|
+
|
301
|
+
root2=tkinter.Tk()
|
302
|
+
|
303
|
+
root2.title('終了')
|
304
|
+
|
305
|
+
root2.geometry('300x200')
|
306
|
+
|
307
|
+
label2=tkinter.Label(root2,text='終了しました')
|
308
|
+
|
309
|
+
label2.grid()
|
310
|
+
|
311
|
+
button2=tkinter.Button(root2,text='完了',command=lambda : pushed2())
|
312
|
+
|
313
|
+
button2.grid()
|
314
|
+
|
315
|
+
root2.grab_set()
|
316
|
+
|
317
|
+
root2.wait_window(root2)
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
print('END')
|
322
|
+
|
323
|
+
```
|