-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathM_Trigonometric.py
68 lines (53 loc) · 1.34 KB
/
M_Trigonometric.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
##############################
# import
##############################
import wx
import math
import GUI_Trigonometric
##############################
# GUI的函数桥接
##############################
class CalcFrame(GUI_Trigonometric.Main):
def __init__(self, parent):
# 定义主函数
GUI_Trigonometric.Main.__init__(self, parent)
def Change_Choise(self,event):
if self.Choise.GetSelection() == 0:
self.D_INPUT.Enable(True)
self.S_INPUT.Enable(False)
else:
self.D_INPUT.Enable(False)
self.S_INPUT.Enable(True)
self.RUN(self)
def RUN(self,event):
if self.Choise.GetSelection() == 0:
num_in = self.D_INPUT.GetValue()
num_in = math.radians(num_in)
else:
num_in = self.S_INPUT.GetValue()
if self.m_choice.GetSelection() == 0:
num = math.sin(num_in)
elif self.m_choice.GetSelection() == 1:
num = math.cos(num_in)
elif self.m_choice.GetSelection() == 2:
num = math.tan(num_in)
#num_str = Fraction(Decimal(num))
self.Out.SetValue(str(num))
##print(cmath.pi)
def Close(self, event):
try:
if app.GetAppName() != '_core.cp38-win_amd64':
self.Destroy()
except:
self.Hide()
##############################
# 主函数
##############################
def main():
global app
app = wx.App(False)
frame = CalcFrame(None)
frame.Show(True)
app.MainLoop()
if __name__ == "__main__":
main()