質問編集履歴
5
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
### 該当のソースコード
|
34
34
|
|
35
|
-
import tkinter as tk
|
35
|
+
```import tkinter as tk
|
36
36
|
|
37
37
|
import tkinter.ttk as ttk
|
38
38
|
|
@@ -276,10 +276,22 @@
|
|
276
276
|
|
277
277
|
label_placcement(label_7,330,650)
|
278
278
|
|
279
|
+
#問題ページボタン作成
|
280
|
+
|
281
|
+
button_1 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_1))
|
282
|
+
|
283
|
+
button_2 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_2))
|
284
|
+
|
285
|
+
button_3 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_3))
|
286
|
+
|
287
|
+
button_4 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_4))
|
288
|
+
|
289
|
+
button_5 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_5))
|
290
|
+
|
291
|
+
button_6 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_6))
|
292
|
+
|
279
293
|
|
280
294
|
|
281
|
-
|
282
|
-
|
283
295
|
|
284
296
|
|
285
297
|
|
@@ -292,6 +304,10 @@
|
|
292
304
|
|
293
305
|
|
294
306
|
|
307
|
+
```
|
308
|
+
|
309
|
+
|
310
|
+
|
295
311
|
### 試したこと
|
296
312
|
|
297
313
|
|
4
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,6 +16,14 @@
|
|
16
16
|
|
17
17
|
'NoneType' object has no attribute 'place'
|
18
18
|
|
19
|
+
File "/Users/taiki/Desktop/Integral.py", line 77, in label_placcement
|
20
|
+
|
21
|
+
label_name.place(x=x_coord,y=y_coord)
|
22
|
+
|
23
|
+
File "/Users/taiki/Desktop/Integral.py", line 116, in <module>
|
24
|
+
|
25
|
+
label_placcement(label_1,400,50)
|
26
|
+
|
19
27
|
エラーメッセージ
|
20
28
|
|
21
29
|
```
|
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -268,22 +268,10 @@
|
|
268
268
|
|
269
269
|
label_placcement(label_7,330,650)
|
270
270
|
|
271
|
-
#問題ページボタン作成
|
272
|
-
|
273
|
-
button_1 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_1))
|
274
|
-
|
275
|
-
button_2 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_2))
|
276
|
-
|
277
|
-
button_3 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_3))
|
278
|
-
|
279
|
-
button_4 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_4))
|
280
|
-
|
281
|
-
button_5 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_5))
|
282
|
-
|
283
|
-
button_6 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_6))
|
284
|
-
|
285
271
|
|
286
272
|
|
273
|
+
|
274
|
+
|
287
275
|
|
288
276
|
|
289
277
|
|
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,18 +24,160 @@
|
|
24
24
|
|
25
25
|
### 該当のソースコード
|
26
26
|
|
27
|
+
import tkinter as tk
|
28
|
+
|
29
|
+
import tkinter.ttk as ttk
|
30
|
+
|
31
|
+
from sympy import *
|
32
|
+
|
33
|
+
import pandas as pd
|
34
|
+
|
35
|
+
import numpy as np
|
36
|
+
|
37
|
+
import random
|
38
|
+
|
39
|
+
import matplotlib.pyplot as plt
|
40
|
+
|
41
|
+
from sympy.matrices import common
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
#シンボルを定義
|
46
|
+
|
47
|
+
x = Symbol("x")
|
48
|
+
|
49
|
+
y = Symbol("y")
|
50
|
+
|
51
|
+
z = Symbol("z")
|
52
|
+
|
53
|
+
a = Symbol("a")
|
54
|
+
|
55
|
+
b = Symbol("b")
|
56
|
+
|
57
|
+
c = Symbol("c")
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
#基礎問題生成
|
62
|
+
|
63
|
+
for i in range(10):
|
64
|
+
|
65
|
+
Question_No = random.randint(1,3)
|
66
|
+
|
67
|
+
Val_No_1 = random.randint(1,9)
|
68
|
+
|
69
|
+
Val_No_2 = random.randint(1,9)
|
70
|
+
|
71
|
+
Val_No_3 = random.randint(1,9)
|
72
|
+
|
73
|
+
if Question_No == 1:
|
74
|
+
|
75
|
+
if Val_No_1 == 1:
|
76
|
+
|
77
|
+
Integ = x
|
78
|
+
|
79
|
+
ans = integrate(Integ)
|
80
|
+
|
81
|
+
out_Integ = "∮"+"x"+" "+"dx"
|
82
|
+
|
83
|
+
else:
|
84
|
+
|
85
|
+
Integ =Val_No_1*x
|
86
|
+
|
87
|
+
ans = integrate(Integ)
|
88
|
+
|
89
|
+
out_Integ ="∮"+str(Val_No_1)+"x"+" "+"dx"
|
90
|
+
|
91
|
+
elif Question_No == 2:
|
92
|
+
|
93
|
+
if Val_No_1 and Val_No_2 == 1:
|
94
|
+
|
95
|
+
Integ = x**2+x
|
96
|
+
|
97
|
+
ans = integrate(Integ)
|
98
|
+
|
99
|
+
out_Integ = "∮"+"x**2"+"+"+"x"+" "+"dx"
|
100
|
+
|
101
|
+
else:
|
102
|
+
|
103
|
+
Integ = Val_No_1*x**2+Val_No_2*x
|
104
|
+
|
105
|
+
asn = integrate(Integ)
|
106
|
+
|
107
|
+
out_Integ = "∮"+str(Val_No_1)+"x**2"+"+"+str(Val_No_2)+"x"+" "+"dx"
|
108
|
+
|
109
|
+
else:
|
110
|
+
|
111
|
+
if Val_No_1 and Val_No_2 and Val_No_3== 1:
|
112
|
+
|
113
|
+
Integ = x**3+x**2+x
|
114
|
+
|
115
|
+
ans = integrate(Integ)
|
116
|
+
|
117
|
+
out_Integ = "∮"+"x**3"+"+"+"x**2"+"+"+"x"+"+"+" "+"dx"
|
118
|
+
|
119
|
+
else:
|
120
|
+
|
121
|
+
Integ = Val_No_1*x**3+Val_No_2*x**2+Val_No_3
|
122
|
+
|
123
|
+
ans = integrate(Integ)
|
124
|
+
|
125
|
+
out_Integ = "∮"+str(Val_No_1)+"x**3"+"+"+str(Val_No_2)+"x**2"+"+"+str(Val_No_3)+"+"+"x"+" "+"dx"
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
#ウィンドウ切り替え
|
130
|
+
|
131
|
+
def change_window(frame_name):
|
132
|
+
|
133
|
+
frame_name.tkraise()
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
#問題ページの作成
|
138
|
+
|
139
|
+
def create_question(frame_name,change_frame):
|
140
|
+
|
141
|
+
label_1 = ttk.Label(frame_name,text="以下の問題を解いてください")
|
142
|
+
|
143
|
+
label_app = ttk.Label(frame_name,text=out_Integ)
|
144
|
+
|
145
|
+
Entry_app = ttk.Entry(frame_name,width=30)
|
146
|
+
|
147
|
+
button_home = ttk.Button(frame_name,text="ホームに戻る",command=lambda:change_window(change_frame))
|
148
|
+
|
149
|
+
answer_button = ttk.Button(frame_name,text="回答",command=Answer_button)
|
150
|
+
|
151
|
+
label_1.pack()
|
152
|
+
|
153
|
+
label_app.pack()
|
154
|
+
|
155
|
+
Entry_app.place(x=300,y=300)
|
156
|
+
|
157
|
+
button_home.place(x=350,y=420)
|
158
|
+
|
159
|
+
answer_button.place(x=350,y=520)
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
#ラベル生成
|
164
|
+
|
165
|
+
def label_create(frame_name,text_name):
|
166
|
+
|
167
|
+
label_frame = ttk.Label(frame_name,text=text_name)
|
168
|
+
|
169
|
+
#ボタン生成
|
170
|
+
|
171
|
+
def button_create(frame_name,text_name,button_name,change_window_name):
|
172
|
+
|
173
|
+
button_frame = ttk.Button(frame_name,text=text_name,command=lambda:button_name(change_window_name))
|
174
|
+
|
175
|
+
#ラベル配置
|
176
|
+
|
27
177
|
def label_placcement(label_name,x_coord,y_coord):
|
28
178
|
|
29
179
|
label_name.place(x=x_coord,y=y_coord)
|
30
180
|
|
31
|
-
```ここに言語名を入力 python
|
32
|
-
|
33
|
-
ソースコード
|
34
|
-
|
35
|
-
def label_placcement(label_name,x_coord,y_coord):
|
36
|
-
|
37
|
-
label_name.place(x=x_coord,y=y_coord)
|
38
|
-
|
39
181
|
#ボタン配置
|
40
182
|
|
41
183
|
def button_lpaccement(button_name,x_coord,y_coord):
|
@@ -46,6 +188,8 @@
|
|
46
188
|
|
47
189
|
|
48
190
|
|
191
|
+
|
192
|
+
|
49
193
|
if __name__ == "__main__":
|
50
194
|
|
51
195
|
root = tk.Tk()
|
@@ -66,47 +210,89 @@
|
|
66
210
|
|
67
211
|
frame_app_1 = ttk.Frame(root)
|
68
212
|
|
69
|
-
frame.grid(row=0,column=0,sticky="nsew",pady=20)
|
213
|
+
frame_app_1.grid(row=0,column=0,sticky="nsew",pady=20)
|
214
|
+
|
70
|
-
|
215
|
+
frame_app_2 = ttk.Frame(root)
|
216
|
+
|
71
|
-
|
217
|
+
frame_app_2.grid(row=0,column=0,sticky="nsew",pady=20)
|
218
|
+
|
72
|
-
|
219
|
+
frame_app_3 = ttk.Frame(root)
|
220
|
+
|
221
|
+
frame_app_3.grid(row=0,column=0,sticky="nsew",pady=20)
|
222
|
+
|
223
|
+
frame_app_4 = ttk.Frame(root)
|
224
|
+
|
225
|
+
frame_app_4.grid(row=0,column=0,sticky="nsew",pady=20)
|
226
|
+
|
227
|
+
frame_app_5 = ttk.Frame(root)
|
228
|
+
|
229
|
+
frame_app_5.grid(row=0,column=0,sticky="nsew",pady=20)
|
230
|
+
|
231
|
+
frame_app_6 = ttk.Frame(root)
|
232
|
+
|
233
|
+
frame_app_6.grid(row=0,column=0,sticky="nsew",pady=20)
|
234
|
+
|
235
|
+
|
236
|
+
|
73
|
-
#ホームウィジェット作成
|
237
|
+
#ホームウィジェット作成
|
74
|
-
|
238
|
+
|
75
|
-
label_1 = label_
|
239
|
+
label_1 = label_create(frame,"あなたの成長する積分アプリ")
|
76
|
-
|
240
|
+
|
77
|
-
label_2 = label_
|
241
|
+
label_2 = label_create(frame,"⚠️x**2はxの2乗x**3はxの3乗を表しています")
|
78
|
-
|
242
|
+
|
79
|
-
label_3 = label_
|
243
|
+
label_3 = label_create(frame,"1:基本レベル")
|
80
|
-
|
244
|
+
|
81
|
-
label_4 = label_
|
245
|
+
label_4 = label_create(frame,"2:定期テストレベル")
|
82
|
-
|
246
|
+
|
83
|
-
label_5 = label_
|
247
|
+
label_5 = label_create(frame,"3:センター試験レベル")
|
84
|
-
|
248
|
+
|
85
|
-
label_6 = label_
|
249
|
+
label_6 = label_create(frame,"4:難関私立レベル")
|
86
|
-
|
250
|
+
|
87
|
-
label_6 = label_
|
251
|
+
label_6 = label_create(frame,"5:難関国公立レベル")
|
88
|
-
|
252
|
+
|
89
|
-
label_7 = label_
|
253
|
+
label_7 = label_create(frame,"6:弱点レベル")
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
label_placcement(label_1,400,50)
|
258
|
+
|
259
|
+
label_placcement(label_2,400,150)
|
260
|
+
|
261
|
+
label_placcement(label_3,330,250)
|
262
|
+
|
263
|
+
label_placcement(label_4,330,350)
|
264
|
+
|
265
|
+
label_placcement(label_5,330,450)
|
266
|
+
|
267
|
+
label_placcement(label_6,330,550)
|
268
|
+
|
269
|
+
label_placcement(label_7,330,650)
|
270
|
+
|
271
|
+
#問題ページボタン作成
|
272
|
+
|
273
|
+
button_1 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_1))
|
274
|
+
|
275
|
+
button_2 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_2))
|
276
|
+
|
277
|
+
button_3 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_3))
|
278
|
+
|
279
|
+
button_4 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_4))
|
280
|
+
|
281
|
+
button_5 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_5))
|
282
|
+
|
283
|
+
button_6 = ttk.Button(frame,text="問題へ",command=lambda:change_window(frame_app_6))
|
90
284
|
|
91
285
|
|
92
286
|
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
93
|
-
|
293
|
+
frame.tkraise()
|
94
|
-
|
294
|
+
|
95
|
-
|
295
|
+
root.mainloop()
|
96
|
-
|
97
|
-
label_placcement(label_3,330,250)
|
98
|
-
|
99
|
-
label_placcement(label_4,330,350)
|
100
|
-
|
101
|
-
label_placcement(label_5,330,450)
|
102
|
-
|
103
|
-
label_placcement(label_6,330,550)
|
104
|
-
|
105
|
-
label_placcement(label_7,330,650)
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
```
|
110
296
|
|
111
297
|
|
112
298
|
|
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -5,14 +5,6 @@
|
|
5
5
|
'NoneType' object has no attribute 'place'と表示されます
|
6
6
|
|
7
7
|
label_nameのところがなぜかnoneになります
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
ここに質問の内容を詳しく書いてください。
|
12
|
-
|
13
|
-
(例)PHP(CakePHP)で●●なシステムを作っています。
|
14
|
-
|
15
|
-
■■な機能を実装中に以下のエラーメッセージが発生しました。
|
16
8
|
|
17
9
|
|
18
10
|
|
@@ -24,7 +16,7 @@
|
|
24
16
|
|
25
17
|
'NoneType' object has no attribute 'place'
|
26
18
|
|
27
|
-
エラーメッセージ
|
19
|
+
エラーメッセージ
|
28
20
|
|
29
21
|
```
|
30
22
|
|
@@ -36,13 +28,9 @@
|
|
36
28
|
|
37
29
|
label_name.place(x=x_coord,y=y_coord)
|
38
30
|
|
39
|
-
```ここに言語名を入力
|
31
|
+
```ここに言語名を入力 python
|
40
32
|
|
41
33
|
ソースコード
|
42
|
-
|
43
|
-
```
|
44
|
-
|
45
|
-
#ラベル配置
|
46
34
|
|
47
35
|
def label_placcement(label_name,x_coord,y_coord):
|
48
36
|
|
@@ -118,6 +106,10 @@
|
|
118
106
|
|
119
107
|
|
120
108
|
|
109
|
+
```
|
110
|
+
|
111
|
+
|
112
|
+
|
121
113
|
### 試したこと
|
122
114
|
|
123
115
|
|