求助各位Tk以及Tkinter大神,要是没有人帮,我真得就无助了啊啊!!
具体问题看这里:
http://topic.csdn.net/u/20110615/15/3e0d6328-c694-4673-a17f-a93bb9e38996.html
我不是自己不努力,我已经搞了好几天了,可实在不行啊,没办法了,求各位大神伸手援助小弟!!!求求你们了,我真得是搞不定这个问题啊!!!
http://topic.csdn.net/u/20110615/15/3e0d6328-c694-4673-a17f-a93bb9e38996.html
我不是自己不努力,我已经搞了好几天了,可实在不行啊,没办法了,求各位大神伸手援助小弟!!!求求你们了,我真得是搞不定这个问题啊!!!
作者: XIANXir 发布时间: 2011-06-16
angle_su的建议很好啊,你试过了吗?
作者: panghuhu250 发布时间: 2011-06-17
不是说了试试pil嘛,函数参数长得很像tk,你学过tk这个应该容易上手。或者下面例子调度下win api函数从屏幕取色,同之前的例子类似,你点中图形有提示...
Python code
Python code
from Tkinter import * import tkMessageBox from ctypes import * def callback(event): x, y = event.x, event.y items = canvas.find_overlapping(x, y, x, y) if items: left, top, right, bottom = canvas.bbox(items[0]) ox, oy = canvas.winfo_rootx(), canvas.winfo_rooty() msg = [] for y in range(oy+top, oy+bottom): for x in range(ox+left, ox+right): rgb = GetPixel(hdc, x, y) if rgb == 0xffffff: msg.append('. ') else: msg.append('* ') msg.append('\n') tkMessageBox.showinfo('tk', ''.join(msg)) CreateDC = windll.gdi32.CreateDCA hdc = CreateDC('DISPLAY', None, None, None) GetPixel = windll.gdi32.GetPixel root = Tk() canvas = Canvas(root, width=200, height=200, bg='white') canvas.pack() canvas.create_text(100, 100, fill='black', font=('Arial', 10, NORMAL), text='H') canvas.bind('<Button-1>', callback) root.mainloop()
作者: angel_su 发布时间: 2011-06-17
很久没搞这东西,好像忘了DeleteDC,不知道会怎样...
作者: angel_su 发布时间: 2011-06-17