美文网首页
开源一个wxpython写的mac桌面程序

开源一个wxpython写的mac桌面程序

作者: liu_bo | 来源:发表于2015-08-12 16:57 被阅读772次

     import wx

    import os

    import datetime

    import time

    app = wx.App()

    win = wx.Frame(None,title = 'tool',size = (800,800))

    win.Show()

    def hi(evt):

    # os.system('open '+filename.GetValue())

    f = filename.GetValue()

    print f

    ltime=time.localtime(float(f)/1000.)

    timeStr=time.strftime("%Y-%m-%d %H:%M:%S", ltime)

    contens.Clear()

    contens.AppendText(timeStr)

    print timeStr

    def utf8f():

    str = "hi"

    contens.AppendText(str)

    print str.encode("UTF-8")

    def s():

    f = filename.GetValue()

    fo = open(f)

    f.write(contents.GetValue())

    loadButton = wx.Button(win,label = 'utf8',pos = (225,5),size = (80,25))

    saveButton = wx.Button(win,label = 'save',pos = (315,5),size = (80,25))

    timeButton = wx.Button(win,label = 'mytime',pos = (415,5),size = (80,25))

    timeButton.Bind(wx.EVT_BUTTON,hi)

    loadButton.Bind(wx.EVT_BUTTON,utf8f)

    filename = wx.TextCtrl(win,pos = (5,5),size = (210,25))

    contens = wx.TextCtrl(win,pos= (5,135),size = (800,260),style = wx.TE_MULTILINE|wx.HSCROLL)

    app.MainLoop()

    tool

    后续会加入更多小工具

    相关文章

      网友评论

          本文标题:开源一个wxpython写的mac桌面程序

          本文链接:https://www.haomeiwen.com/subject/iwwiqttx.html