2004年09月05日 星期日 00:22
非常感谢,由于我刚学不久,很多不懂的问题,请问大家可以帮忙将下面的程序加上注解吗?非常感谢!请帮帮,谢谢
====================================
给你个示例代码,具体的功能你自己扩充。
import win32gui
import win32com
import win32com.client
import pythoncom
import time
class test:
def tt(self):
print 'tt'
class EventHandler(test):
def init(self):
ie =
win32com.client.DispatchWithEvents("InternetExplorer.Application",
EventHandler)
ie.Visible = 1
ie.Navigate("www.aawns.com")
# Important you have to pump messages in some way, because the
# COM event mechanism depends on using window messages to dispatch
# incoming calls
#print pythoncom.PumpMessages()
print dir(ie)
pythoncom.PumpMessages()
#~ while ie.Visible:
#~ time.sleep(2)
#~ print 'looping'
ie.Quit()
def OnVisible(self, visible):
global bVisibleEventFired
bVisibleEventFired = 1
def OnDownloadBegin(self):
print "DownloadBegin"
def OnDownloadComplete(self):
print "DownloadComplete"
def OnDocumentComplete(self, pDisp = pythoncom.Missing , URL =
pythoncom.Missing):
print "documentComplete of %s" % URL
self.url=URL
self.tt()
a=EventHandler()
a.init()
============================
笑剑飞霜的信件内容:
我的弟弟不太听话,现在我想通过python学习做个小软件,我就可以管好我的弟弟,也可以让自已练习一下基本功,软件的功能很简单,做一个自动启动的后台程序,我弟在浏览的地址栏中输入网址,在打开网页的同时,可以将这个网址传到我的后台程序中并记录在一个记事本中,现在我搞不明白,python如何可以截获输入的网址。请问这个后台小软件会很难做吗?如何进行截获输入的网址?
-------------------------------------------------------------------------------------
周杰伦在"第一现场"与你面对面 http://smspop.163.com/special/jay200408/index2.html
2004年09月05日 星期日 08:41
建议你先把关于python的基础知识打扎实点,这段代码你自然就看懂了。
笑剑飞霜的信件内容:
> 非常感谢,由于我刚学不久,很多不懂的问题,请问大家可以帮忙将下面的程序加上注解吗?非常感谢!请帮帮,谢谢
> ====================================
> 给你个示例代码,具体的功能你自己扩充。
>
> import win32gui
> import win32com
> import win32com.client
> import pythoncom
> import time
>
>
> class test:
>
> def tt(self):
> print 'tt'
>
> class EventHandler(test):
> def init(self):
> ie =
> win32com.client.DispatchWithEvents("InternetExplorer.Application",
> EventHandler)
> ie.Visible = 1
> ie.Navigate("www.aawns.com")
>
> # Important you have to pump messages in some way, because the
> # COM event mechanism depends on using window messages to dispatch
> # incoming calls
>
> #print pythoncom.PumpMessages()
> print dir(ie)
> pythoncom.PumpMessages()
> #~ while ie.Visible:
> #~ time.sleep(2)
> #~ print 'looping'
>
> ie.Quit()
>
> def OnVisible(self, visible):
> global bVisibleEventFired
> bVisibleEventFired = 1
> def OnDownloadBegin(self):
> print "DownloadBegin"
> def OnDownloadComplete(self):
> print "DownloadComplete"
> def OnDocumentComplete(self, pDisp = pythoncom.Missing , URL =
> pythoncom.Missing):
> print "documentComplete of %s" % URL
> self.url=URL
> self.tt()
>
>
>
> a=EventHandler()
> a.init()
>
> ============================
>
> 笑剑飞霜的信件内容:
>
> 我的弟弟不太听话,现在我想通过python学习做个小软件,我就可以管好我的弟弟,也可以让自已练习一下基本功,软件的功能很简单,做一个自动启动的后台程序,我弟在浏览的地址栏中输入网址,在打开网页的同时,可以将这个网址传到我的后台程序中并记录在一个记事本中,现在我搞不明白,python如何可以截获输入的网址。请问这个后台小软件会很难做吗?如何进行截获输入的网址?
>
>
> -------------------------------------------------------------------------------------
> 周杰伦在"第一现场"与你面对面 http://smspop.163.com/special/jay200408/index2.html
Zeuux © 2025
京ICP备05028076号