pywinauto Listview GetItem(5,0)['text'] 是空

王漠言 2014-09-25 03:44:48
我用pywinauto去选择我要在控制面板中的应用程序,可以用Index可以选择,我想用Text去选择,我无法获得Text,请问大家什么问题?

#Start Control Panel
os.system('{0}\\System32\\control.exe appwiz.cpl'.format(os.environ['WINDIR'])) # open control panel
time.sleep(3)

#Focus the application
pwa_app = pywinauto.application.Application()
#try:

w_handle = pywinauto.findwindows.find_windows(title=u'Programs and Features', class_name='CabinetWClass')[0]
window = pwa_app.window_(handle=w_handle)
window.SetFocus()
ctrl = window['ListView']
ctrl_items = ctrl.Items()
ctrl_Texts = ctrl.Texts()
ctrl_GetItems = ctrl.GetItem(5,0)['text']
ctrl.Select(5)
print "Texts: ",ctrl_Texts[5]
print "GetItem: ",ctrl_GetItems
...全文
595 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

37,719

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧