#-*- coding:gbk -*-
'''
Created on 2012-3-18
@author: Administrator
'''
import wx
import Constans
import MyUtil
#-*- coding:gbk -*-
'''
Created on 2012-3-18
@author: Administrator
'''
import wx
import Constans
import MyUtil
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, Constans.main_window_title,
size=(Constans.main_window_width, Constans.main_window_height))
panel = wx.Panel(self, -1)
panel.Bind(wx.EVT_MOTION, self.onMouse)
wx.StaticText(panel, -1, "Position", pos=(6, 12))
self.posCtrl = wx.TextCtrl(panel, -1, "", pos=(50, 10))
menuBar = wx.MenuBar()
menul = wx.Menu()
menul.Append(wx.NewId(), "&Open", "Open")
menuBar.Append(menul, "&File")
menul2 = wx.Menu()
menul2.Append(wx.NewId(), "&Copy", "Copy")
menul2.AppendSeparator()
menul2.Append(wx.NewId(), "&Cut", "Cut")
menuBar.Append(menul2, "&Edit")
stats = wx.StatusBar(self)
stats.SetStatusText(Constans.main_window_status_txt+MyUtil.getDefaultLocalDate())
self.SetStatusBar(stats)
self.SetMenuBar(menuBar)
def onMouse(self, event):
pos = event.GetPosition()
self.posCtrl.SetValue("%s,%s" % (pos.x, pos.y))
if __name__ == '__main__':
try:
app = wx.PySimpleApp()
frame = MyFrame()
frame.Center()
frame.Show()
app.MainLoop()
except Exception, e:
print e
Constans.py--------------------------------------------------------------------
#-*- coding:gbk -*-
'''
Created on 2012-3-19
@author: Administrator
'''
main_window_title="MySQL 客户端"
main_window_width=700
main_window_height=600
main_window_status_txt="当前时间:"
MyUtil.py--------------------------------------------
#coding:gbk
'''
Created on 2012-3-19
@author: Administrator
'''
import time
_formatStr = "%Y-%m-%d %H:%M:%S"
def __init__(self):
pass
def getLocalDate(timeArg):
return time.strftime(_formatStr, timeArg)
'''
获取格式化的时间
'''
def getDefaultLocalDate():
return time.strftime(_formatStr, time.localtime())