import os
try:
import pyqrcode
import cv2
except Exception:
os.system("pip install pyqrcode")
os.system("pip install opencv-python")
ssid = input("\nEnter WiFi SSID: ")
authtypes = ["WEP", "WPA", 'nopass', 'nopass']
authnums = ["1", "2", "3", "", ""]
print("\nEnter\n1)\tWEP")
print("2)\tWPA/WPA2")
print("3)\tNone")
type = authtypes[authnums.index(input())]
password = None
imagename = "WIFI QR"
if type!=None:
password = input("\nEnter Wifi password: ")
hidtemp = input("\nIs wifi hidden? enter 1 if yes ")
if hidtemp==1:
hidden = True
else:
hidden=False
wifidata = f'WIFI:T:{type};S:{ssid};P:{password};H:{hidden};;'
datysvd = pyqrcode.create(wifidata)
datysvd.png(imagename, scale = 10)
image = cv2.imread(imagename)
window_name = 'qrcode'
cv2.imshow(window_name, image)
cv2.waitKey(0)
cv2.destroyAllWindows()
os.remove(imagename)