下面的代码是通过python IDE运行的,但不是从CMD或直接执行的

问题描述 投票:1回答:1
import webbrowser
import pyautogui
import time

webbrowser.open("https://meet.google.com/huq-etkk-pwv",new=0,autoraise=True)

#auto_input
time.sleep(10)
pyautogui.hotkey('ctrl','d')
pyautogui.hotkey('ctrl','e')
time.sleep(2)
#custom coordinates are adviced
#coordinates work on standard chrome window with 1920*1080 screen size 16:9 ratio
pyautogui.click(972,428)

当我通过CMD运行这个模块时,我在pyautogui模块中得到一个错误,Tk()名称没有定义,当我尝试直接执行这个模块时,它只是打开了一个CMD窗口,然后停止,什么也不做,但当我通过Python IDE运行它时,它可以完美地工作。

python python-3.x time pyautogui python-webbrowser
1个回答
0
投票

你的代码在我的Kubuntu(18.04.)上运行得很好,你用的是哪个IDE?有没有可能,它默认运行的python版本和你的CMD不同(比如IDE中的3.7和CMD中的2.7)?

P.S.本来想发在评论里的,但是缺乏名声。

© www.soinside.com 2019 - 2024. All rights reserved.