• wxpython总体


    人到夏天就特别懒

    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

  • 相关阅读:
    TCC
    使用RocketMQ实现分布式事务
    CentOS关机
    使用grub手动引导linux和windows
    CentOS下X Window与命令行界面的切换
    Centos下 为firefox安装flash插件
    tar.xz文件如何解压
    用Linux命令wget进行整站下载
    CentOS关闭火狐浏览器Flash过期提示
    CentOS普通用户添加sudo权限
  • 原文地址:https://www.cnblogs.com/mghhzAnne/p/10830351.html
Copyright © 2020-2023  润新知