易截截图软件、单文件、免安装、纯绿色、仅160KB

将Python和AutoHotkey结合起来

http://www.autohotkey.com/forum/topic53773.html
Q:I am searching for is a way to execute AHK commands from a Python script. Is this possible?
A:Yes. Here is an example. 
tested with python2.6, requires AutoHotkey.dll in the working directory or path... 
ahkpython.py:
#Persistent
dllcall(A_ScriptParams, "int", 42, "cdecl int")
return
f1::
inputbox, x, enter a numerical parameter for python callback
result := dllcall(A_ScriptParams, "int", x, "cdecl int")
return 
ahkpython.ahk
from ctypes import *
ahk = cdll.AutoHotkey
pyclient = create_string_buffer("ahkpython.ahk") # no unicode in ahk
CMPFUNC = CFUNCTYPE(c_int, c_int)
def py_cmp_func(a):
print "ahk: " , a
return a
cmp_func = CMPFUNC(py_cmp_func)
fx = create_string_buffer(str(cast(cmp_func, c_void_p).value))
script = create_string_buffer("""
fx2(msg){
WinActivate %msg%
msgbox in function fx2 with %msg% from python
return "success"
}
""")
ahk.ahkdll(pyclient, "", fx)
ahk.ahkassign(create_string_buffer("fx"), fx)
ahk.addScript(script)
ahk.ahkFunction(create_string_buffer("fx2"), create_string_buffer("Untitled")) 
remarks: 
create_string_buffer is required because autohotkey.dll exported functions do not work with unicode. 
See HotkeyIt's excellent chm help file for documentation on the functions.


相关文档:

用python进行GUI开发的选择

Python最大的特点就在于她的快速开发功能。作为一种胶水型语言,python几乎可以渗透在我们编程过程中的各个领域。这里我简单介绍一下用python进行gui开发的一些选择。
 1.Tkinter
 Tkinter似乎是与tcl语言同时发展起来的一种界面库。tkinter是python的配备的标准gui库,也是opensource的产物。Tkinter可用于win ......

python中import自己写的模块

只需要在文件中import与你写的文件的文件名一致的模块名即可,这时python会为你创建一个pyc文件的。
即,如果你已经写了一个名为ssss.py的文件,而现在你需要在名为aaaa.py的文件中使用ssss.py中定义的方法,那么你只需要在aaaa.py中加入import ssss,然后你就可以在aaaa.py中使用ssss.py中的方法(当然方法前需要加模块名 ......

用Python写的图片蜘蛛人


    写了个图片蜘蛛人玩玩,抓了几个网页试试,感觉不不错。核心的代码可能20行也不到,简洁明了,嘻嘻。废话少说,翠花,上代码~~
#coding=utf-8
import os
import sys
import re
import urllib
URL_REG = re.compile(r'(http://[^/\\]+)', re.I)
IMG_REG = re.compile(r'<img[^>]*?src=([ ......

python操作excel性能问题求助

http://bbs.chinaunix.net/thread-1586782-1-1.html
我刚刚用python写了一段操作excel的脚本,目的是把一个excel文件按照某一列中的字段拆分成多个文件,例如按照城市或者省份等,但是发现处理一个1700行的文件拆分成40多个文件时要运行30分钟左右,性能太慢,请高手帮忙看看怎么才能优化性能,谢谢。
新手写的脚本,请不 ......

Python与Microsoft Office自动化操作

http://www.cnblogs.com/Jedimaster/archive/2007/02/28/660209.html
  朋友的家人做生意,每日从各地分店处收集报表,然后回去汇总。由于不想用那种复杂的管理软件,就叫他写一个小工具。于是他找到了我,让我想想办法。
  Python是个令人惊奇的工具,而不仅仅是一种语言。对比老牌的Perl,看似Python不是那么的精通 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号