-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path製作管理員加扣分JSON.py
103 lines (94 loc) · 2.89 KB
/
製作管理員加扣分JSON.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import json
def make(TotalStudentNum):
FirstLayerBoxContents = [ {
"type": "box",
"layout": "vertical",
"contents": [
{
"type": "text",
"text": "T.加扣分",
"weight": "bold",
"size": "xl"
},
{
"type": "text",
"text": "編輯結束請按編輯完成鈕"
},
{
"type": "separator",
"margin": "md"
},]
}]
for i in range(1,TotalStudentNum+1):
FirstLayerBoxContents.append( {
"type": "box",
"layout": "horizontal",
"contents": [
{
"type": "text",
"text": "%i號"%i,
"gravity": "center",
"align": "center"
},
{
"type": "button",
"action": {
"type": "postback",
"label": "十",
"data": "ManageEditingPoint&Num&Plus&%i"%i
}
,
"height": "sm"
},
{
"type": "button",
"action": {
"type": "postback",
"label": "一",
"data": "ManageEditingPoint&Num&down&%i"%i#不用minus因為醬+-都可以直接取得號碼,不用分開寫(down字數與Plus同)
}
,
"height": "sm"
}
]
})
data = {
"type": "bubble",
"body": {
"type": "box",
"layout": "vertical",
"contents": FirstLayerBoxContents,
"spacing": "xs",
"margin": "none"
}
,
"footer": {
"type": "box",
"layout": "vertical",
"contents": [
{
"type": "button",
"action": {
"type": "postback",
"label": "編輯完成鈕",
"data": "ManageEditingPoint&Fin"
},
"style": "secondary",
"height": "sm"
},
{
"type": "button",
"action": {
"type": "postback",
"label": "不用改了",
"data": "ManageEndEditPoint"
},
"height": "sm"
}
]
}
}
import os
os.system("echo fin 管理員加扣分.json")
with open('管理員加扣分.json', 'w', encoding='utf-8') as f:
json.dump(data, f)