我正在制作一个实用程序,其中内置了多个程序,但我对程序进行了一些更改,以便在用户提示时重新运行,然后由于某种原因,我面临错误
import * only allowed at module level
这是我的代码
def main():
import os
import sys
import time
import pywhatkit as whatsapp
from speedtest import Speedtest
from tkinter import *
from tkinter import messagebox
from os import listdir
from PIL import Image
print("*"*30)
print("Utility Build v1: Starting")
print("*"*30)
time.sleep(3)
print("NOTE: Before using this program for repairing corrupted disk, please locate this utility .py file into the corrupted storage. Thanks")
time.sleep(3)
print("*"*30)
print("*"*30)
print("Commands: Choose by inputting allocated number")
print("Utility 1: Speed Test")
print("Utility 2: Whatsapp Message Automation")
time.sleep(2)
print("Please Wait...Loading")
time.sleep(4)
print("Utility 3: Disk/Removable Storage Repair(a.k.a Dr Corrupt)")
print("Utility 4: Python .py status monitor")
print("*"*30)
print("*"*30)
print("q = Quit Utility Program")
input_ = input(": ")
if input_ == "q":
exit()
if input_ == "1":
time.sleep(2)
print("*"*30)
print("Speed Test: Starting")
print("*"*30)
st = Speedtest()
Download_ = print("Your connection download speed is:", st.download())
Upload_ = print("Your connection upload speed is:", st.upload())
Download1_ = st.download()
Upload1_ = st.upload()
print("*"*30)
print("Speed Test: Finishing Up!")
print("*"*30)
answer = input("Would you like results? ")
if answer == "yes":
print("NOTE: The first 2 digits frm the left is your internet speed")
time.sleep(2)
top = Tk()
top.geometry("100x100")
messagebox.showinfo("Speed Test: Download", Download1_)
top.mainloop()
侃侃无极
相关分类