toolimport 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()
后续会加入更多小工具
网友评论