-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManuel_Calculation.html
More file actions
121 lines (105 loc) · 2.75 KB
/
Manuel_Calculation.html
File metadata and controls
121 lines (105 loc) · 2.75 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>簡易入力電卓</title>
<script type="text/javascript" src="brython/www/src/brython.js">
</script>
<script type="text/javascript" src="brython/www/src/brython_stdlib.js">
</script>
<style type="text/css">
body{
background-color: #2b2b2b;
color: #e4cfcf;
font-size: 23px;
display:inline;
}
input{
font: sans-serif;
font-size: 25px;
width: 400px;
height: 50px;
padding: 0.3em;
transition: 0.3s;
color: #d3d3d3;
border: none;
border-bottom: 2px solid #1b2538;
background-color: #463939;
outline-color: #343434;
outline-style: groove;
outline-width: 4.1px;
}
input#Resulter{
font-size: 25px;
width: 200px;
height: 50px;
}
div#Calculation_Field{
display:inline;
font-size: 25px;
}
button{
background-color: #4f4f4f;
color: #e4cfcf;
font-size: 35px;
width: 40px;
height: 55px;
outline: 0;
display:inline;
}
a:link { color: #e4d7a6; }
a:visited { color: #e4d7a6; }
a:hover { color: #e4d7a6; }
a:active { color: #e4d7a6; }
a{
font-family: sans-serif;
font-size: 23px;
}
div#Calculation_Field{
font-size: 35px;
}
</style>
</head>
<body onload="brython()">
<script type="text/python">
from browser import document, html, bind
document["TITLE"] <= "簡易入力電卓"
def Calculation():
calculation_title = html.I('計算式:')
calculation = html.INPUT()
calculation_Btn = html.BUTTON("=")
Percent_Btn = html.BUTTON("%")
Result = html.INPUT('', Id="Resulter")
document['Calculation_Field'] <= calculation_title + html.I(" ") + calculation + html.I(" ") + calculation_Btn + html.I(" ") + Result + html.I(" ") + Percent_Btn
calculation.focus()
return calculation, Result, calculation_Btn, Percent_Btn
def ClearResult():
document["Resulter"] <= ''
def main():
Calculation_Formula, Results, Result_Button, Percent_Button = Calculation()
@bind(Result_Button, 'click')
def Calculate(c):
ClearResult()
if Calculation_Formula.value == '':
Calculation_Formula.value = '0'
try:
Results.value = '{}'.format(eval(Calculation_Formula.value))
except ZeroDivisionError:
Results.value = '0'
@bind(Percent_Button, 'click')
def Percents(_):
Results.value = eval("{}/100".format(Results.value))
main()
</script>
<h4 style="display: inline;"><a href="https://crossdarkrix.github.io/ToramHTMLTools/" style="display: inline;">トップページに戻る</a></h4>
<h2 id="TITLE"></h2>
<div>
使い方: %を使う場合は一度「=」を押してから%を押してください。<br>
 ÷: /<br>
 ×: *<br>
を入力してください。<br><br>
<div id="Calculation_Field"></div>
</div><br>
<h3><br><br><br>
</h3>
</body>
</html>