質問編集履歴
6
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -152,7 +152,7 @@
|
|
152
152
|
|
153
153
|
# 追記
|
154
154
|
|
155
|
-
ラズパイで
|
155
|
+
ラズパイで、最前面ウィンドウのみ閉じる・最大化ボタンのみ効くように変更。
|
156
156
|
|
157
157
|
```Python
|
158
158
|
|
@@ -164,6 +164,8 @@
|
|
164
164
|
|
165
165
|
global win_flag, sub1_flag, sub2_flag
|
166
166
|
|
167
|
+
sub1_win.resizable(0, 0)
|
168
|
+
|
167
169
|
win_flag = False
|
168
170
|
|
169
171
|
sub1_flag = False
|
@@ -184,15 +186,15 @@
|
|
184
186
|
|
185
187
|
sub2_win.focus_set()
|
186
188
|
|
187
|
-
sub2_win.protocol("WM_DELETE_WINDOW", lambda:close_sub2_win(sub2_win))
|
189
|
+
sub2_win.protocol("WM_DELETE_WINDOW", lambda:close_sub2_win(sub1_win, sub2_win))
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
195
|
-
def close_sub2_win(sub2_win):
|
197
|
+
def close_sub2_win(sub1_win, sub2_win):
|
196
198
|
|
197
199
|
global win_flag, sub1_flag, sub2_flag
|
198
200
|
|
@@ -208,6 +210,8 @@
|
|
208
210
|
|
209
211
|
sub2_flag = False
|
210
212
|
|
213
|
+
sub1_win.resizable(1, 1)
|
214
|
+
|
211
215
|
|
212
216
|
|
213
217
|
|
@@ -216,6 +220,8 @@
|
|
216
220
|
|
217
221
|
global win_flag, sub1_flag, sub2_flag
|
218
222
|
|
223
|
+
win.resizable(0, 0)
|
224
|
+
|
219
225
|
win_flag = False
|
220
226
|
|
221
227
|
sub1_flag = True
|
@@ -236,7 +242,7 @@
|
|
236
242
|
|
237
243
|
sub1_win.focus_set()
|
238
244
|
|
239
|
-
sub1_win.protocol("WM_DELETE_WINDOW", lambda:close_sub1_win(sub1_win))
|
245
|
+
sub1_win.protocol("WM_DELETE_WINDOW", lambda:close_sub1_win(win, sub1_win))
|
240
246
|
|
241
247
|
btn = tk.Button(sub1_win, text="open_sub2_win", command=lambda:open_sub2_win(win, sub1_win))
|
242
248
|
|
@@ -248,7 +254,7 @@
|
|
248
254
|
|
249
255
|
|
250
256
|
|
251
|
-
def close_sub1_win(sub1_win):
|
257
|
+
def close_sub1_win(win, sub1_win):
|
252
258
|
|
253
259
|
global win_flag, sub1_flag, sub2_flag
|
254
260
|
|
@@ -264,6 +270,8 @@
|
|
264
270
|
|
265
271
|
sub2_flag = False
|
266
272
|
|
273
|
+
win.resizable(1, 1)
|
274
|
+
|
267
275
|
|
268
276
|
|
269
277
|
def close_win(win):
|
@@ -302,4 +310,6 @@
|
|
302
310
|
|
303
311
|
win.mainloop()
|
304
312
|
|
313
|
+
|
314
|
+
|
305
315
|
```
|
5
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -147,3 +147,159 @@
|
|
147
147
|
win.mainloop()
|
148
148
|
|
149
149
|
```
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
# 追記
|
154
|
+
|
155
|
+
ラズパイでも最前面の閉じるボタンのみ効くように変更。
|
156
|
+
|
157
|
+
```Python
|
158
|
+
|
159
|
+
import tkinter as tk
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
def open_sub2_win(win, sub1_win):
|
164
|
+
|
165
|
+
global win_flag, sub1_flag, sub2_flag
|
166
|
+
|
167
|
+
win_flag = False
|
168
|
+
|
169
|
+
sub1_flag = False
|
170
|
+
|
171
|
+
sub2_flag = True
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
sub2_win = tk.Toplevel()
|
176
|
+
|
177
|
+
sub2_win.title("sub2_win")
|
178
|
+
|
179
|
+
sub2_win.geometry("300x300+200+200")
|
180
|
+
|
181
|
+
sub2_win.transient(sub1_win)
|
182
|
+
|
183
|
+
sub2_win.grab_set()
|
184
|
+
|
185
|
+
sub2_win.focus_set()
|
186
|
+
|
187
|
+
sub2_win.protocol("WM_DELETE_WINDOW", lambda:close_sub2_win(sub2_win))
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
def close_sub2_win(sub2_win):
|
196
|
+
|
197
|
+
global win_flag, sub1_flag, sub2_flag
|
198
|
+
|
199
|
+
if sub2_flag == True:
|
200
|
+
|
201
|
+
sub2_win.grab_release()
|
202
|
+
|
203
|
+
sub2_win.destroy()
|
204
|
+
|
205
|
+
win_flag = False
|
206
|
+
|
207
|
+
sub1_flag = True
|
208
|
+
|
209
|
+
sub2_flag = False
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
def open_sub1_win(win):
|
216
|
+
|
217
|
+
global win_flag, sub1_flag, sub2_flag
|
218
|
+
|
219
|
+
win_flag = False
|
220
|
+
|
221
|
+
sub1_flag = True
|
222
|
+
|
223
|
+
sub2_flag = False
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
sub1_win = tk.Toplevel()
|
228
|
+
|
229
|
+
sub1_win.title("sub1_win")
|
230
|
+
|
231
|
+
sub1_win.geometry("300x300+100+100")
|
232
|
+
|
233
|
+
sub1_win.transient(win)
|
234
|
+
|
235
|
+
sub1_win.grab_set()
|
236
|
+
|
237
|
+
sub1_win.focus_set()
|
238
|
+
|
239
|
+
sub1_win.protocol("WM_DELETE_WINDOW", lambda:close_sub1_win(sub1_win))
|
240
|
+
|
241
|
+
btn = tk.Button(sub1_win, text="open_sub2_win", command=lambda:open_sub2_win(win, sub1_win))
|
242
|
+
|
243
|
+
btn.grid()
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
def close_sub1_win(sub1_win):
|
252
|
+
|
253
|
+
global win_flag, sub1_flag, sub2_flag
|
254
|
+
|
255
|
+
if sub1_flag == True:
|
256
|
+
|
257
|
+
sub1_win.grab_release()
|
258
|
+
|
259
|
+
sub1_win.destroy()
|
260
|
+
|
261
|
+
win_flag = True
|
262
|
+
|
263
|
+
sub1_flag = False
|
264
|
+
|
265
|
+
sub2_flag = False
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
def close_win(win):
|
270
|
+
|
271
|
+
global win_flag, sub1_flag, sub2_flag
|
272
|
+
|
273
|
+
if win_flag == True:
|
274
|
+
|
275
|
+
win.destroy()
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
win_flag = True
|
280
|
+
|
281
|
+
sub1_flag = False
|
282
|
+
|
283
|
+
sub2_flag = False
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
win = tk.Tk()
|
288
|
+
|
289
|
+
win.title("win")
|
290
|
+
|
291
|
+
win.geometry("300x300+0+0")
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
btn = tk.Button(win, text="open_sub1_win", command=lambda:open_sub1_win(win))
|
296
|
+
|
297
|
+
btn.grid()
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
win.protocol("WM_DELETE_WINDOW", lambda:close_win(win))
|
302
|
+
|
303
|
+
win.mainloop()
|
304
|
+
|
305
|
+
```
|
4
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
実現したいこと
|
1
|
+
# 実現したいこと
|
2
2
|
|
3
3
|
|
4
4
|
|
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,7 +64,7 @@
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
-
|
67
|
+
# ソースコード
|
68
68
|
|
69
69
|
|
70
70
|
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -52,13 +52,17 @@
|
|
52
52
|
|
53
53
|
|
54
54
|
|
55
|
+
![イメージ説明](0299b5055a01609c1f61191de005c8a1.png)
|
56
|
+
|
57
|
+
|
58
|
+
|
55
59
|
# 質問
|
56
60
|
|
57
61
|
Windowsのような挙動が理想ですが、Raspberry Piで同じ挙動を実現させるための対処方法はありますか。
|
58
62
|
|
59
63
|
|
60
64
|
|
61
|
-
|
65
|
+
|
62
66
|
|
63
67
|
|
64
68
|
|
1
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -55,6 +55,10 @@
|
|
55
55
|
# 質問
|
56
56
|
|
57
57
|
Windowsのような挙動が理想ですが、Raspberry Piで同じ挙動を実現させるための対処方法はありますか。
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
![イメージ説明](0299b5055a01609c1f61191de005c8a1.png)
|
58
62
|
|
59
63
|
|
60
64
|
|