Python实现简单时间人流数据收集工具


同事(www.apinglai.com)周末去某克咖啡收集人流数据,  花了点时间弄了个简单的工具给他 。


太久没写python了,感觉手有点生,用到的知识点


#如何引入module 
import Tkinter


#创建window
root = Tkinter.Tk(className="阿平打点软件 V1")
#在xy轴200-200的位置创建400*220的窗口
root.geometry("400x220+200+200") 


#执行system command
import os
os.system('ping www.pythontab.com') // 返回值是结果


#LINUX获取日期时间的命令 date
#echo $(date)
# >> 重定向


$python 判断操作系统类型代码
import platform
# "Windows" "Linux"
platform.system()

由于内容比较少,所以code的比较随便哈哈:)


#encoding:utf-8 

# author: richard

import platform
import os
from Tkinter import *

inLog = 'C:/inlog.txt'
outLog = 'C:/outlog.txt'

systemString = platform.system()

class App:
    def __init__(self, master):

        frame = Frame(master)
        frame.pack()

        self.buttonIn = Button(frame, text="  入  ", command=self.inHandler)
        self.buttonIn.pack(side=LEFT)

        self.buttonOut = Button(frame, text="  出  ", command=self.outHandler)
        self.buttonOut.pack(side=RIGHT)

    def inHandler(self):
        if(systemString =="Windows"):
            os.system ('echo %time% >> '+inLog)
        else:
            os.system ('echo $(date) >> '+inLog)

    def outHandler(self):
        if(systemString =="Windows"):
            os.system ('echo %time% >> '+outLog)
        else:
            os.system ('echo $(date) >> '+outLog)

root = Tk(className="阿平打点 V1")
root.geometry("200x100+200+200")
app = App(root)

root.mainloop()



参考资料:

http://www.pythonware.com/library/tkinter/introduction/index.htm

http://outofmemory.cn/code-snippet/458/python-decide-caozuoxitong-type-code


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值