zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    在其他对象上同步
    如何在一个线程环境中使用一个线程非安全的java类
    原子类
    Volatile
    Spring中的设计模式2
    Spring中的设计模式
    Struts2中的设计模式
    Struts2中的设计模式----ThreadLocal模式
    享元模式(Flyweight)
    Java类加载器的工作原理
  • 原文地址:https://www.cnblogs.com/mghhzAnne/p/10830351.html
Copyright © 2011-2022 走看看