python - python中的Pywhatkit不向whatsapp组发送消息
问题描述
我正在使用 tkinter 并在 gui 中获取用户的输入,并通过单击按钮在 pywhatkit 的帮助下发送消息,但它只是打开 whatsapp(仅打开组 whatsapp)而且它没有给我任何错误请告诉我怎么能我解决它
编辑 - 现在我收到一个错误 -
whats = pg.getWindowsWithTitle("WhatsApp")[0]
IndexError: list index out of range
我的代码 -
# Text Box for mobile number and text
mobileNumber = Text(root, height=1, width=20, font="Calibri")
text = Text(root, height=4, width=17, font="Calibri")
hour = Text(root, height=1, width=20, font="Calibri")
minute = Text(root, height=1, width=20, font="Calibri")
# creating button
def click():
finalMobileNumber = mobileNumber.get(1.0, "end-1c")
finalText = text.get(1.0, "end-1c")
finalText = str(finalText)
finalHour = hour.get(1.0, "end-1c")
finalHour = int(finalHour)
finalMinute = minute.get(1.0, "end-1c")
finalMinute = int(finalMinute)
我只在 if 语句中遇到问题
if "https" in finalMobileNumber:
pywhatkit.sendwhatmsg_to_group(finalMobileNumber, finalText, finalHour, finalMinute)
else:
pywhatkit.sendwhatmsg("+91" + finalMobileNumber, finalText, finalHour, finalMinute)
btn = Button(root, text="Send Message", command=click)
解决方案
推荐阅读
- netsuite - 在变量 freemarker 中显示引号 - netsuite 高级 pdf
- powershell - 如何在powershell中访问嵌套对象的绝对值
- java - 如何在java或android中“从没有关键字的文本中识别姓名和父亲姓名”?
- php - 查询 50 GB 数据时性能有什么更好的?是带有条件的 MYSQL SELECT 还是带有过滤器表达式的 Dynamodb SCAN?
- node.js - 无法访问 Lambda 函数中的环境变量
- python - 如何在 python 中使用 pandas 格式化日期和时间
- sql - 如何加快不同条件下多次查询同一张表?
- ios - 无法在 IOS 模拟器上运行 react 本机项目
- javascript - 在javascript中过滤嵌套的JSON数组并返回匹配条件的内部数组
- php - 我应该如何解码正确的 json 响应?