質問編集履歴
2
コード全容を削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -69,305 +69,3 @@
|
|
69
69
|
text_area.grid(column = 0, pady = 10, padx = 10)
|
70
70
|
|
71
71
|
```
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
コード全容
|
80
|
-
|
81
|
-
```Python3
|
82
|
-
|
83
|
-
import tkinter as tk
|
84
|
-
|
85
|
-
from tkinter import scrolledtext
|
86
|
-
|
87
|
-
from tkinter import *
|
88
|
-
|
89
|
-
from tkinter import ttk
|
90
|
-
|
91
|
-
from tkinter import scrolledtext
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
# Generate Window
|
96
|
-
|
97
|
-
root = tk.Tk()
|
98
|
-
|
99
|
-
# title
|
100
|
-
|
101
|
-
root.title('Hotel New World')
|
102
|
-
|
103
|
-
# Window Size
|
104
|
-
|
105
|
-
root.geometry("800x300")
|
106
|
-
|
107
|
-
#MinSixe
|
108
|
-
|
109
|
-
#root.minsize(500, 500)
|
110
|
-
|
111
|
-
#make Window grid 1x1
|
112
|
-
|
113
|
-
# root.grid_rowconfigure(0, weight=1)
|
114
|
-
|
115
|
-
root.grid_columnconfigure(0, weight=1)
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
frame1 = tk.Frame(root, width=800, height=800,
|
120
|
-
|
121
|
-
relief='flat', borderwidth=1)
|
122
|
-
|
123
|
-
frame1.grid(row=0, column=0, sticky=(tk.W, tk.E))
|
124
|
-
|
125
|
-
frame1.grid_columnconfigure(0, weight=1)
|
126
|
-
|
127
|
-
frame1.grid_columnconfigure(1, weight=2)
|
128
|
-
|
129
|
-
frame1.grid_columnconfigure(2, weight=1)
|
130
|
-
|
131
|
-
frame1.grid_columnconfigure(3, weight=2)
|
132
|
-
|
133
|
-
frame1.grid_columnconfigure(4, weight=1)
|
134
|
-
|
135
|
-
frame1.grid_columnconfigure(5, weight=1)
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
# Create Menu
|
140
|
-
|
141
|
-
menubar = tk.Menu(root)
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
# FileMenu
|
146
|
-
|
147
|
-
filemenu = tk.Menu(menubar, tearoff=0)
|
148
|
-
|
149
|
-
menubar.add_cascade(label='File', menu=filemenu)
|
150
|
-
|
151
|
-
# filemenu.add_command(label='Import', command=lambda : changePage(frame1))
|
152
|
-
|
153
|
-
filemenu.add_command(label='Import')
|
154
|
-
|
155
|
-
filemenu.add_command(label='Export Data')
|
156
|
-
|
157
|
-
filemenu.add_separator()
|
158
|
-
|
159
|
-
# close button ok
|
160
|
-
|
161
|
-
filemenu.add_command(label='Quit Application', command=lambda: root.destroy())
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
# HelpMenu
|
166
|
-
|
167
|
-
helpmenu = tk.Menu(menubar, tearoff=0)
|
168
|
-
|
169
|
-
menubar.add_cascade(label='Help', menu=helpmenu)
|
170
|
-
|
171
|
-
helpmenu.add_command(label='About Application')
|
172
|
-
|
173
|
-
helpmenu.add_command(label='Developer Information')
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
# Display Menu
|
178
|
-
|
179
|
-
root.config(menu=menubar)
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
label_name = tk.Label(frame1, text="Name", font=('', 10, "bold"))
|
186
|
-
|
187
|
-
label_name.grid(row=0, column=0)
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
entry_name = tk.Entry(frame1)
|
192
|
-
|
193
|
-
entry_name.grid(row=0, column=1, sticky=(tk.W, tk.E))
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
label_country = tk.Label(frame1, text="Country", font=('', 10, "bold"))
|
198
|
-
|
199
|
-
label_country.grid(row=0, column=2)
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
entry_country = tk.Entry(frame1)
|
204
|
-
|
205
|
-
entry_country.grid(row=0, column=3, columnspan=2, sticky=(tk.W, tk.E))
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
label_passport = tk.Label(frame1, text="Passport", font=('', 10, "bold"))
|
210
|
-
|
211
|
-
label_passport.grid(row=1, column=0)
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
entry_passport = tk.Entry(frame1)
|
216
|
-
|
217
|
-
entry_passport.grid(row=1, column=1, sticky=(tk.W, tk.E))
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
label_gender = tk.Label(frame1, text="Gender", font=('', 10, "bold"))
|
222
|
-
|
223
|
-
label_gender.grid(row=1, column=2)
|
224
|
-
|
225
|
-
var = tk.IntVar()
|
226
|
-
|
227
|
-
tk.Radiobutton(frame1, text="Male", variable=var, value=1).grid(row=1, column=3)
|
228
|
-
|
229
|
-
tk.Radiobutton(frame1, text="Female", variable=var, value=2).grid(row=1, column=4)
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
label_from = tk.Label(frame1, text="From", font=('', 10, "bold"))
|
234
|
-
|
235
|
-
label_from.grid(row=2, column=0)
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
entry_from_start = tk.Entry(frame1)
|
240
|
-
|
241
|
-
entry_from_start.grid(row=2, column=1, sticky=(tk.W, tk.E))
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
label_to = tk.Label(frame1, text="to", font=('', 10, "bold"))
|
246
|
-
|
247
|
-
label_to.grid(row=2, column=2)
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
entry_to_end = tk.Entry(frame1)
|
252
|
-
|
253
|
-
entry_to_end.grid(row=2, column=3, columnspan=2, sticky=(tk.W, tk.E))
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
label_accomondation_type = tk.Label(frame1, text="Accomondation Type", font=('', 10, "bold"))
|
258
|
-
|
259
|
-
label_accomondation_type.grid(row=3, column=0)
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
menu_accom = tk.OptionMenu(frame1, 'Accomondations', 'Male Dorm', 'Female Form', 'Doble Room', 'Single Room')
|
264
|
-
|
265
|
-
menu_accom.config(width=20)
|
266
|
-
|
267
|
-
menu_accom.grid(row=3, column=1, sticky=(tk.W, tk.E))
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
btn_book = tk.Button(frame1, text='Book Now', width=10)
|
272
|
-
|
273
|
-
btn_book.grid(row=4, column=4, sticky=tk.E)
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
btn_search = tk.Button(frame1, text='Search Entry', width=10)
|
278
|
-
|
279
|
-
btn_search.grid(row=5, column=4, sticky=tk.E)
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
btn_update = tk.Button(frame1, text='Update Entry', width=10)
|
284
|
-
|
285
|
-
btn_update.grid(row=6, column=4, sticky=tk.E)
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
btn_all = tk.Button(frame1, text='View All Entry', width=10)
|
290
|
-
|
291
|
-
btn_all.grid(row=7, column=4, sticky=tk.E)
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
btn_delete = tk.Button(frame1, text='Delete Selected Entry', width=10)
|
296
|
-
|
297
|
-
btn_delete.grid(row=8, column=4, sticky=tk.E)
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
btn_quit = tk.Button(frame1, text='Quit Application', width=10,command=lambda: root.destroy())
|
302
|
-
|
303
|
-
btn_quit.grid(row=9, column=4, sticky=tk.E)
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
root1 = Tk()
|
308
|
-
|
309
|
-
root1.geometry("300x300")
|
310
|
-
|
311
|
-
root1.title(" Q&A ")
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
def Take_input():
|
316
|
-
|
317
|
-
INPUT = inputtxt.get("1.0", "end-1c")
|
318
|
-
|
319
|
-
print(INPUT)
|
320
|
-
|
321
|
-
if(INPUT == "120"):
|
322
|
-
|
323
|
-
Output.insert(END, 'Correct')
|
324
|
-
|
325
|
-
else:
|
326
|
-
|
327
|
-
Output.insert(END, "Wrong answer")
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
l = Label(text = "What is 24 * 5 ? ")
|
332
|
-
|
333
|
-
inputtxt = Text(root1, height = 10,
|
334
|
-
|
335
|
-
width = 25,
|
336
|
-
|
337
|
-
bg = "light yellow")
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
Output = Text(root1, height = 5,
|
342
|
-
|
343
|
-
width = 25,
|
344
|
-
|
345
|
-
bg = "light cyan")
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
Display = Button(root1, height = 2,
|
350
|
-
|
351
|
-
width = 20,
|
352
|
-
|
353
|
-
text ="Show",
|
354
|
-
|
355
|
-
command = lambda:Take_input())
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
l.pack()
|
360
|
-
|
361
|
-
inputtxt.pack()
|
362
|
-
|
363
|
-
Display.pack()
|
364
|
-
|
365
|
-
Output.pack()
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
# ウィンドウ表示
|
370
|
-
|
371
|
-
root.mainloop()
|
372
|
-
|
373
|
-
```
|
1
コード全容を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -69,3 +69,305 @@
|
|
69
69
|
text_area.grid(column = 0, pady = 10, padx = 10)
|
70
70
|
|
71
71
|
```
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
コード全容
|
80
|
+
|
81
|
+
```Python3
|
82
|
+
|
83
|
+
import tkinter as tk
|
84
|
+
|
85
|
+
from tkinter import scrolledtext
|
86
|
+
|
87
|
+
from tkinter import *
|
88
|
+
|
89
|
+
from tkinter import ttk
|
90
|
+
|
91
|
+
from tkinter import scrolledtext
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
# Generate Window
|
96
|
+
|
97
|
+
root = tk.Tk()
|
98
|
+
|
99
|
+
# title
|
100
|
+
|
101
|
+
root.title('Hotel New World')
|
102
|
+
|
103
|
+
# Window Size
|
104
|
+
|
105
|
+
root.geometry("800x300")
|
106
|
+
|
107
|
+
#MinSixe
|
108
|
+
|
109
|
+
#root.minsize(500, 500)
|
110
|
+
|
111
|
+
#make Window grid 1x1
|
112
|
+
|
113
|
+
# root.grid_rowconfigure(0, weight=1)
|
114
|
+
|
115
|
+
root.grid_columnconfigure(0, weight=1)
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
frame1 = tk.Frame(root, width=800, height=800,
|
120
|
+
|
121
|
+
relief='flat', borderwidth=1)
|
122
|
+
|
123
|
+
frame1.grid(row=0, column=0, sticky=(tk.W, tk.E))
|
124
|
+
|
125
|
+
frame1.grid_columnconfigure(0, weight=1)
|
126
|
+
|
127
|
+
frame1.grid_columnconfigure(1, weight=2)
|
128
|
+
|
129
|
+
frame1.grid_columnconfigure(2, weight=1)
|
130
|
+
|
131
|
+
frame1.grid_columnconfigure(3, weight=2)
|
132
|
+
|
133
|
+
frame1.grid_columnconfigure(4, weight=1)
|
134
|
+
|
135
|
+
frame1.grid_columnconfigure(5, weight=1)
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
# Create Menu
|
140
|
+
|
141
|
+
menubar = tk.Menu(root)
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
# FileMenu
|
146
|
+
|
147
|
+
filemenu = tk.Menu(menubar, tearoff=0)
|
148
|
+
|
149
|
+
menubar.add_cascade(label='File', menu=filemenu)
|
150
|
+
|
151
|
+
# filemenu.add_command(label='Import', command=lambda : changePage(frame1))
|
152
|
+
|
153
|
+
filemenu.add_command(label='Import')
|
154
|
+
|
155
|
+
filemenu.add_command(label='Export Data')
|
156
|
+
|
157
|
+
filemenu.add_separator()
|
158
|
+
|
159
|
+
# close button ok
|
160
|
+
|
161
|
+
filemenu.add_command(label='Quit Application', command=lambda: root.destroy())
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
# HelpMenu
|
166
|
+
|
167
|
+
helpmenu = tk.Menu(menubar, tearoff=0)
|
168
|
+
|
169
|
+
menubar.add_cascade(label='Help', menu=helpmenu)
|
170
|
+
|
171
|
+
helpmenu.add_command(label='About Application')
|
172
|
+
|
173
|
+
helpmenu.add_command(label='Developer Information')
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
# Display Menu
|
178
|
+
|
179
|
+
root.config(menu=menubar)
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
label_name = tk.Label(frame1, text="Name", font=('', 10, "bold"))
|
186
|
+
|
187
|
+
label_name.grid(row=0, column=0)
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
entry_name = tk.Entry(frame1)
|
192
|
+
|
193
|
+
entry_name.grid(row=0, column=1, sticky=(tk.W, tk.E))
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
label_country = tk.Label(frame1, text="Country", font=('', 10, "bold"))
|
198
|
+
|
199
|
+
label_country.grid(row=0, column=2)
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
entry_country = tk.Entry(frame1)
|
204
|
+
|
205
|
+
entry_country.grid(row=0, column=3, columnspan=2, sticky=(tk.W, tk.E))
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
label_passport = tk.Label(frame1, text="Passport", font=('', 10, "bold"))
|
210
|
+
|
211
|
+
label_passport.grid(row=1, column=0)
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
entry_passport = tk.Entry(frame1)
|
216
|
+
|
217
|
+
entry_passport.grid(row=1, column=1, sticky=(tk.W, tk.E))
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
label_gender = tk.Label(frame1, text="Gender", font=('', 10, "bold"))
|
222
|
+
|
223
|
+
label_gender.grid(row=1, column=2)
|
224
|
+
|
225
|
+
var = tk.IntVar()
|
226
|
+
|
227
|
+
tk.Radiobutton(frame1, text="Male", variable=var, value=1).grid(row=1, column=3)
|
228
|
+
|
229
|
+
tk.Radiobutton(frame1, text="Female", variable=var, value=2).grid(row=1, column=4)
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
label_from = tk.Label(frame1, text="From", font=('', 10, "bold"))
|
234
|
+
|
235
|
+
label_from.grid(row=2, column=0)
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
entry_from_start = tk.Entry(frame1)
|
240
|
+
|
241
|
+
entry_from_start.grid(row=2, column=1, sticky=(tk.W, tk.E))
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
label_to = tk.Label(frame1, text="to", font=('', 10, "bold"))
|
246
|
+
|
247
|
+
label_to.grid(row=2, column=2)
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
entry_to_end = tk.Entry(frame1)
|
252
|
+
|
253
|
+
entry_to_end.grid(row=2, column=3, columnspan=2, sticky=(tk.W, tk.E))
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
label_accomondation_type = tk.Label(frame1, text="Accomondation Type", font=('', 10, "bold"))
|
258
|
+
|
259
|
+
label_accomondation_type.grid(row=3, column=0)
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
menu_accom = tk.OptionMenu(frame1, 'Accomondations', 'Male Dorm', 'Female Form', 'Doble Room', 'Single Room')
|
264
|
+
|
265
|
+
menu_accom.config(width=20)
|
266
|
+
|
267
|
+
menu_accom.grid(row=3, column=1, sticky=(tk.W, tk.E))
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
btn_book = tk.Button(frame1, text='Book Now', width=10)
|
272
|
+
|
273
|
+
btn_book.grid(row=4, column=4, sticky=tk.E)
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
btn_search = tk.Button(frame1, text='Search Entry', width=10)
|
278
|
+
|
279
|
+
btn_search.grid(row=5, column=4, sticky=tk.E)
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
btn_update = tk.Button(frame1, text='Update Entry', width=10)
|
284
|
+
|
285
|
+
btn_update.grid(row=6, column=4, sticky=tk.E)
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
btn_all = tk.Button(frame1, text='View All Entry', width=10)
|
290
|
+
|
291
|
+
btn_all.grid(row=7, column=4, sticky=tk.E)
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
btn_delete = tk.Button(frame1, text='Delete Selected Entry', width=10)
|
296
|
+
|
297
|
+
btn_delete.grid(row=8, column=4, sticky=tk.E)
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
btn_quit = tk.Button(frame1, text='Quit Application', width=10,command=lambda: root.destroy())
|
302
|
+
|
303
|
+
btn_quit.grid(row=9, column=4, sticky=tk.E)
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
root1 = Tk()
|
308
|
+
|
309
|
+
root1.geometry("300x300")
|
310
|
+
|
311
|
+
root1.title(" Q&A ")
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
def Take_input():
|
316
|
+
|
317
|
+
INPUT = inputtxt.get("1.0", "end-1c")
|
318
|
+
|
319
|
+
print(INPUT)
|
320
|
+
|
321
|
+
if(INPUT == "120"):
|
322
|
+
|
323
|
+
Output.insert(END, 'Correct')
|
324
|
+
|
325
|
+
else:
|
326
|
+
|
327
|
+
Output.insert(END, "Wrong answer")
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
l = Label(text = "What is 24 * 5 ? ")
|
332
|
+
|
333
|
+
inputtxt = Text(root1, height = 10,
|
334
|
+
|
335
|
+
width = 25,
|
336
|
+
|
337
|
+
bg = "light yellow")
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
Output = Text(root1, height = 5,
|
342
|
+
|
343
|
+
width = 25,
|
344
|
+
|
345
|
+
bg = "light cyan")
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
Display = Button(root1, height = 2,
|
350
|
+
|
351
|
+
width = 20,
|
352
|
+
|
353
|
+
text ="Show",
|
354
|
+
|
355
|
+
command = lambda:Take_input())
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
l.pack()
|
360
|
+
|
361
|
+
inputtxt.pack()
|
362
|
+
|
363
|
+
Display.pack()
|
364
|
+
|
365
|
+
Output.pack()
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
# ウィンドウ表示
|
370
|
+
|
371
|
+
root.mainloop()
|
372
|
+
|
373
|
+
```
|