首页 > 编程语言 > 详细

wxpython总体

时间:2019-05-08 11:04:48      阅读:152      评论:0      收藏:0      [点我收藏+]

人到夏天就特别懒

from math import *

import wx

def sin_fun(event):
    a=text_angle.GetValue()
    b=sin(radians(float(a)))
    text_result.SetValue(str(round(b,3)))

def cos_fun(event):
    a=text_angle.GetValue()
    b=cos(radians(float(a)))
    text_result.SetValue(str(round(b,3)))

def tan_fun(event):
    a=text_angle.GetValue()
    b=tan(radians(float(a)))
    text_result.SetValue(str(round(b,3)))

def cot_fun(event):
    a = text_angle.GetValue()
    b = tan(radians(float(a)))
    text_result.SetValue(str(round(1/b, 3)))

app=wx.App()
frame=wx.Frame(None,title=waves,pos=(200,200),size=(800,400))
button_sin=wx.Button(frame,label=sin,pos=(20,20),size=(80,40))
button_cos=wx.Button(frame,label=cos,pos=(200,20),size=(80,40))
button_tan=wx.Button(frame,label=tan,pos=(380,20),size=(80,40))
button_cot=wx.Button(frame,label=cot,pos=(560,20),size=(80,40))
text=wx.StaticText(frame,label=请输入角度,pos=(290,100),size=(80,20))
text_angle=wx.TextCtrl(frame,pos=(290,150),size=(80,20))
text1=wx.StaticText(frame,label=结果,pos=(290,200),size=(80,20))
text_result=wx.TextCtrl(frame,pos=(290,250),size=(80,20))

button_sin.Bind(wx.EVT_BUTTON,sin_fun)
button_cos.Bind(wx.EVT_BUTTON,cos_fun)
button_tan.Bind(wx.EVT_BUTTON,tan_fun)
button_cot.Bind(wx.EVT_BUTTON,cot_fun)


frame.Show()
app.MainLoop()

 

 

wxpython文档:http://xoomer.virgilio.it/infinity77/wxPython/widgets.html

wxpython总体

原文:https://www.cnblogs.com/mghhzAnne/p/10830351.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!